parser

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package parser provides parsers for SQLite SQL statements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatLiterals

func FormatLiterals(literals []ast.Literal) string

FormatLiterals returns a string representation of the literals

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser represents a SQL parser for SQLite.

func New

func New(l *lexer.Lexer) *Parser

New creates a new Parser.

func (*Parser) Errors

func (p *Parser) Errors() []string

Errors returns any parsing errors.

func (*Parser) ParseProgram

func (p *Parser) ParseProgram() *ast.Program

ParseProgram parses a complete SQL program.

type SimpleLiteralParser

type SimpleLiteralParser struct {
	// contains filtered or unexported fields
}

SimpleLiteralParser is a lightweight parser that only extracts literals from SQL

func NewSimpleLiteralParser

func NewSimpleLiteralParser(input string) *SimpleLiteralParser

NewSimpleLiteralParser creates a new SimpleLiteralParser

func (*SimpleLiteralParser) ExtractLiterals

func (p *SimpleLiteralParser) ExtractLiterals() []ast.Literal

ExtractLiterals extracts all literals from an SQL statement

func (*SimpleLiteralParser) ParseCondition

func (p *SimpleLiteralParser) ParseCondition(input string) ast.Expression

ParseCondition parses a WHERE condition

func (*SimpleLiteralParser) ParseUpdateSetPairs

func (p *SimpleLiteralParser) ParseUpdateSetPairs(input string) []ast.SetPair

ParseUpdateSetPairs parses key-value pairs in an UPDATE statement

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL