Documentation ¶
Index ¶
- Variables
- func NewEater(scanner *Scanner) *eater
- func SyntaxStringFromIdent(tkn *Token) string
- type DeleteMode
- type DeleteQuery
- func (q *DeleteQuery) AddParam(key, val string)
- func (q *DeleteQuery) Args() []*Token
- func (q *DeleteQuery) Fields() (out []string)
- func (q *DeleteQuery) KindSyntaxString() string
- func (q *DeleteQuery) SetParams(p map[string]string)
- func (q *DeleteQuery) String() string
- func (q *DeleteQuery) StringKR() string
- func (q *DeleteQuery) StringSingle() string
- func (q *DeleteQuery) Table() string
- func (q *DeleteQuery) Tokens() []*Token
- func (q *DeleteQuery) Type() QueryType
- type InsertMode
- type InsertQuery
- func (q *InsertQuery) AddParam(key, val string)
- func (q *InsertQuery) Args() []*Token
- func (q *InsertQuery) Fields() []string
- func (q *InsertQuery) SetParams(p map[string]string)
- func (q *InsertQuery) String() string
- func (q *InsertQuery) Table() string
- func (q *InsertQuery) Tokens() []*Token
- func (q *InsertQuery) Type() QueryType
- type Mode
- type Parser
- type Query
- type QueryType
- type Scanner
- func (s *Scanner) Peek(num int) []*Token
- func (s *Scanner) Read() (rune, bool)
- func (s *Scanner) Scan() *Token
- func (s *Scanner) ScanDirective() *Token
- func (s *Scanner) ScanIdentifier() *Token
- func (s *Scanner) ScanNumber() *Token
- func (s *Scanner) ScanSpecial() *Token
- func (s *Scanner) ScanString() *Token
- func (s *Scanner) ScanWhitespace() *Token
- func (s *Scanner) Unread()
- type SelectMode
- type SelectQuery
- func (q *SelectQuery) AddParam(key, val string)
- func (q *SelectQuery) Args() []*Token
- func (q *SelectQuery) Fields() (out []string)
- func (q *SelectQuery) SetParams(p map[string]string)
- func (q *SelectQuery) String() string
- func (q *SelectQuery) Table() string
- func (q *SelectQuery) Tokens() []*Token
- func (q *SelectQuery) Type() QueryType
- type StartMode
- type Token
- type TokenGroup
- type TokenKind
- type UpdateMode
- type UpdateQuery
- func (q *UpdateQuery) AddParam(key, val string)
- func (q *UpdateQuery) Args() []*Token
- func (q *UpdateQuery) Fields() (out []string)
- func (q *UpdateQuery) SetParams(p map[string]string)
- func (q *UpdateQuery) String() string
- func (q *UpdateQuery) Table() string
- func (q *UpdateQuery) Tokens() []*Token
- func (q *UpdateQuery) Type() QueryType
Constants ¶
This section is empty.
Variables ¶
View Source
var TokenKeyWords map[TokenKind][]string = map[TokenKind][]string{ ILLEGAL: []string{"ILLEGAL"}, EOF: []string{"EOF"}, WS: []string{"any whitespace"}, COMMA: []string{","}, OPEN_PARAN: []string{"("}, CLOSE_PARAN: []string{")"}, EQUAL_OP: []string{"="}, GREATER_OP: []string{">"}, LESS_OP: []string{"<"}, GREATER_EQUAL_OP: []string{">="}, LESS_EQUAL_OP: []string{"<="}, IDENT_STRING: []string{"'abc 123'", "\"abc_123\""}, IDENT_FLOAT: []string{"1.00", "0.5"}, IDENT_INT: []string{"123"}, IDENT_FIELD: []string{"@fieldName", "@field_name"}, IDENT_BOOL: []string{"true", "false"}, IDENT_TABLE_OR_COL: []string{"table_name", "columnName", "(notice lack of quotes)"}, IDENT_DIRECTIVE: []string{"@{FORCE_INDEX=some_index}", "@{...}"}, INSERT: []string{"INSERT", "insert"}, UPDATE: []string{"UPDATE", "update"}, DELETE: []string{"DELETE", "delete"}, SELECT: []string{"SELECT", "select"}, FROM: []string{"FROM", "from"}, INTO: []string{"INTO", "into"}, VALUES: []string{"VALUES", "values"}, SET: []string{"SET", "set"}, AND: []string{"AND", "and"}, OR: []string{"OR", "or"}, START: []string{"START", "start"}, END: []string{"END", "end"}, KIND: []string{"KIND", "kind"}, CLOSED_OPEN_KIND: []string{ "CLOSED_OPEN", "closed_open", "ClosedOpen", "closedOpen", "CO", "co", }, CLOSED_CLOSED_KIND: []string{ "CLOSED_CLOSED", "closed_closed", "ClosedClosed", "closedClosed", "CC", "cc", }, OPEN_OPEN_KIND: []string{ "OPEN_OPEN", "open_open", "OpenOpen", "openOpen", "OO", "oo", }, OPEN_CLOSED_KIND: []string{ "OPEN_CLOSED", "open_closed", "OpenClosed", "openClosed", "OC", "oc", }, PRIMARY_KEY: []string{ "PRIMARY_KEY", "primary_key", "PrimaryKey", "primaryKey", "PK", "pk", }, }
View Source
var TokenNames map[TokenKind]string = map[TokenKind]string{ ILLEGAL: "ILLEGAL", EOF: "EOF", WS: "WS", COMMA: "COMMA", OPEN_PARAN: "OPEN_PARAN", CLOSE_PARAN: "CLOSE_PARAN", EQUAL_OP: "EQUAL_OP", GREATER_OP: "GREATER_OP", LESS_OP: "LESS_OP", GREATER_EQUAL_OP: "GREATER_EQUAL_OP", LESS_EQUAL_OP: "LESS_EQUAL_OP", IDENT_STRING: "IDENT_STRING", IDENT_FLOAT: "IDENT_FLOAT", IDENT_INT: "IDENT_INT", IDENT_FIELD: "IDENT_FIELD", IDENT_BOOL: "IDENT_BOOL", IDENT_TABLE_OR_COL: "IDENT_TABLE_OR_COL", IDENT_DIRECTIVE: "IDENT_DIRECTIVE", INSERT: "INSERT", UPDATE: "UPDATE", DELETE: "DELETE", SELECT: "SELECT", FROM: "FROM", INTO: "INTO", VALUES: "VALUES", SET: "SET", AND: "AND", OR: "OR", START: "START", END: "END", KIND: "KIND", CLOSED_OPEN_KIND: "CLOSED_OPEN_KIND", CLOSED_CLOSED_KIND: "CLOSED_CLOSED_KIND", OPEN_OPEN_KIND: "OPEN_OPEN_KIND", OPEN_CLOSED_KIND: "OPEN_CLOSED_KIND", PRIMARY_KEY: "PRIMARY_KEY", }
Functions ¶
func SyntaxStringFromIdent ¶
Types ¶
type DeleteQuery ¶
type DeleteQuery struct {
// contains filtered or unexported fields
}
func (*DeleteQuery) AddParam ¶
func (q *DeleteQuery) AddParam(key, val string)
func (*DeleteQuery) Args ¶
func (q *DeleteQuery) Args() []*Token
func (*DeleteQuery) Fields ¶
func (q *DeleteQuery) Fields() (out []string)
func (*DeleteQuery) KindSyntaxString ¶
func (q *DeleteQuery) KindSyntaxString() string
func (*DeleteQuery) SetParams ¶
func (q *DeleteQuery) SetParams(p map[string]string)
func (*DeleteQuery) String ¶
func (q *DeleteQuery) String() string
func (*DeleteQuery) StringKR ¶
func (q *DeleteQuery) StringKR() string
func (*DeleteQuery) StringSingle ¶
func (q *DeleteQuery) StringSingle() string
func (*DeleteQuery) Table ¶
func (q *DeleteQuery) Table() string
func (*DeleteQuery) Tokens ¶
func (q *DeleteQuery) Tokens() []*Token
func (*DeleteQuery) Type ¶
func (q *DeleteQuery) Type() QueryType
type InsertQuery ¶
type InsertQuery struct {
// contains filtered or unexported fields
}
func (*InsertQuery) AddParam ¶
func (q *InsertQuery) AddParam(key, val string)
func (*InsertQuery) Args ¶
func (q *InsertQuery) Args() []*Token
func (*InsertQuery) Fields ¶
func (q *InsertQuery) Fields() []string
func (*InsertQuery) SetParams ¶
func (q *InsertQuery) SetParams(p map[string]string)
func (*InsertQuery) String ¶
func (q *InsertQuery) String() string
func (*InsertQuery) Table ¶
func (q *InsertQuery) Table() string
func (*InsertQuery) Tokens ¶
func (q *InsertQuery) Tokens() []*Token
func (*InsertQuery) Type ¶
func (q *InsertQuery) Type() QueryType
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func NewScanner ¶
func (*Scanner) Peek ¶
peek the number ahead of tokens since we cant unscan tokens, set these peeked tokens as next to be scanned
func (*Scanner) Scan ¶
if there is peeked tokens, return those first. otherwise if there is an error, return that as an illegal token, otherwise perform scan
func (*Scanner) ScanDirective ¶
func (*Scanner) ScanIdentifier ¶
func (*Scanner) ScanNumber ¶
func (*Scanner) ScanSpecial ¶
func (*Scanner) ScanString ¶
func (*Scanner) ScanWhitespace ¶
type SelectMode ¶
type SelectMode struct {
// contains filtered or unexported fields
}
we don't parse anything for select mode
func NewSelectMode ¶
func NewSelectMode() *SelectMode
type SelectQuery ¶
type SelectQuery struct {
// contains filtered or unexported fields
}
func NewSelectQuery ¶
func NewSelectQuery(q string, fields []*Token) *SelectQuery
func (*SelectQuery) AddParam ¶
func (q *SelectQuery) AddParam(key, val string)
func (*SelectQuery) Args ¶
func (q *SelectQuery) Args() []*Token
func (*SelectQuery) Fields ¶
func (q *SelectQuery) Fields() (out []string)
func (*SelectQuery) SetParams ¶
func (q *SelectQuery) SetParams(p map[string]string)
func (*SelectQuery) String ¶
func (q *SelectQuery) String() string
func (*SelectQuery) Table ¶
func (q *SelectQuery) Table() string
func (*SelectQuery) Tokens ¶
func (q *SelectQuery) Tokens() []*Token
func (*SelectQuery) Type ¶
func (q *SelectQuery) Type() QueryType
type TokenGroup ¶
type TokenGroup []hasable
func Group ¶
func Group(tkns ...hasable) TokenGroup
func (TokenGroup) Has ¶
func (tkns TokenGroup) Has(in TokenKind) bool
func (TokenGroup) Values ¶
func (tkns TokenGroup) Values() (ret []TokenKind)
type TokenKind ¶
type TokenKind int
const ( // special ILLEGAL TokenKind = iota EOF WS COMMA OPEN_PARAN CLOSE_PARAN //Operators EQUAL_OP GREATER_OP LESS_OP GREATER_EQUAL_OP LESS_EQUAL_OP IDENT_STRING IDENT_FLOAT IDENT_INT IDENT_FIELD IDENT_BOOL // kind of its own thing, it represents the literal column or table name IDENT_TABLE_OR_COL // not used yet, but exists and looks like @{...} IDENT_DIRECTIVE // Keywords INSERT UPDATE DELETE SELECT FROM INTO VALUES SET AND OR START END KIND CLOSED_OPEN_KIND CLOSED_CLOSED_KIND OPEN_OPEN_KIND OPEN_CLOSED_KIND PRIMARY_KEY )
type UpdateQuery ¶
type UpdateQuery struct {
// contains filtered or unexported fields
}
func (*UpdateQuery) AddParam ¶
func (q *UpdateQuery) AddParam(key, val string)
func (*UpdateQuery) Args ¶
func (q *UpdateQuery) Args() []*Token
func (*UpdateQuery) Fields ¶
func (q *UpdateQuery) Fields() (out []string)
func (*UpdateQuery) SetParams ¶
func (q *UpdateQuery) SetParams(p map[string]string)
func (*UpdateQuery) String ¶
func (q *UpdateQuery) String() string
func (*UpdateQuery) Table ¶
func (q *UpdateQuery) Table() string
func (*UpdateQuery) Tokens ¶
func (q *UpdateQuery) Tokens() []*Token
func (*UpdateQuery) Type ¶
func (q *UpdateQuery) Type() QueryType
Click to show internal directories.
Click to hide internal directories.