Documentation ¶
Index ¶
Constants ¶
const ( UNUSED = 0 SCRIPT = 5000 NAME = 5001 DESCRIPTION = 5002 LAST_UPDATED = 5003 UPDATED_BY = 5004 TEST = 5005 DEV = 5006 PD_BEGIN = 5007 PD_END = 5008 PD_REF = 5009 PD_MIG = 5015 COMMENT = 5010 PD_FILE = 5011 PROD = 5012 LOCAL = 5013 INT = 5014 AND = 6001 OR = 6002 NE = 6003 SHIFT_LEFT = 6004 NULL_SAFE_EQUAL = 6005 LE = 6006 GE = 6007 SHIFT_RIGHT = 6008 VALUE_ARG = 7001 STRING = 7002 HEX = 7003 FLOAT = 7004 BIT_LITERAL = 7005 LIST_ARG = 7006 INTEGRAL = 7007 HEXNUM = 7008 LEX_ERROR = 8000 ID = 9000 )
Variables ¶
This section is empty.
Functions ¶
func KeywordString ¶
KeywordString returns the string corresponding to the given keyword
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer represents the domain for our lexer
type NestedSQLQuery ¶
SQLQuery represents the domain for a SQL query when referenced by another query
type SQLDirectives ¶
type SQLDirectives struct { Name string Description string Prod struct { Keywords map[string]string NestedSQL []*NestedSQLQuery } Dev struct { Keywords map[string]string NestedSQL []*NestedSQLQuery } Local struct { Keywords map[string]string NestedSQL []*NestedSQLQuery } Int struct { Keywords map[string]string NestedSQL []*NestedSQLQuery } }
SQLDirectives represents the domain for a fully parsed SQL script
func Parse ¶
func Parse(sql string) (*SQLDirectives, error)
Parse returns SQLDirectives from a SQL script
type SQLMngr ¶
type SQLMngr struct { Raw string Parsed string Directives *SQLDirectives DirectiveKeyOverrides map[string]string Err error Env string Migrations map[string][]*sqlMig.SQLMigrationStrategy Stack []*SQLStack StackDepth int Root map[string]string Getter getter }
SQLMngr represents the domain of a SQL scripts combined with any migrations for that table
type SQLStack ¶
type SQLStack struct { SQL string Directives *SQLDirectives Nested bool Level int SQuery *NestedSQLQuery }
SQLStack represents the domain of a parsed SQL script, including any nested SQL referenced
type Tokenizer ¶
type Tokenizer struct { InStream io.Reader AllowComments bool ForceEOF bool Position int LastError error // contains filtered or unexported fields }
Tokenizer is the struct used to generate SQL tokens for the parser.
func NewStringTokenizer ¶
NewStringTokenizer creates a new Tokenizer for the sql string.
func NewTokenizer ¶
NewTokenizer creates a new Tokenizer reading a sql string from the io.Reader.