Documentation
¶
Index ¶
- func ScanSqlChars(data []byte, atEOF bool) (advance int, token []byte, err error)
- type CreateIndexData
- type CreateTableData
- type CreateViewData
- type DeleteData
- type InsertData
- type Lexer
- func (l *Lexer) EatDelim(d rune)
- func (l *Lexer) EatId() string
- func (l *Lexer) EatIntConstant() int
- func (l *Lexer) EatKeyword(w string)
- func (l *Lexer) EatStringConstant() string
- func (l *Lexer) MatchDelim(d rune) bool
- func (l *Lexer) MatchId() bool
- func (l *Lexer) MatchKeyword(w string) bool
- func (l *Lexer) MatchStringConstant() bool
- type ModifyData
- type Parser
- func (p *Parser) Constant() *record.Constant
- func (p *Parser) CreateIndex() *CreateIndexData
- func (p *Parser) CreateTable() *CreateTableData
- func (p *Parser) CreateView() *CreateViewData
- func (p *Parser) Delete() *DeleteData
- func (p *Parser) Expression() *query.Expression
- func (p *Parser) Field() string
- func (p *Parser) Insert() *InsertData
- func (p *Parser) Modify() *ModifyData
- func (p *Parser) Predicate() *query.Predicate
- func (p *Parser) Query() *QueryData
- func (p *Parser) Term() *query.Term
- func (p *Parser) UpdateCmd() interface{}
- type PredParser
- type QueryData
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateIndexData ¶
type CreateIndexData struct {
// contains filtered or unexported fields
}
CreateIndexData is the parser for the "create index" statement.
func NewCreateIndexData ¶
func NewCreateIndexData(idxname, tblname, fldname string) *CreateIndexData
NewCreateIndexData saves the table and field names of the specified index.
func (*CreateIndexData) FieldName ¶
func (c *CreateIndexData) FieldName() string
FieldName returns the name of the indexed field.
func (*CreateIndexData) IndexName ¶
func (c *CreateIndexData) IndexName() string
IndexName returns the name of the index.
func (*CreateIndexData) TableName ¶
func (c *CreateIndexData) TableName() string
TableName returns the name of the indexed table.
type CreateTableData ¶
type CreateTableData struct {
// contains filtered or unexported fields
}
CreateTableData is the data for the SQL "create table" statement.
func NewCreateTableData ¶
func NewCreateTableData(tblname string, sch *record.Schema) *CreateTableData
NewCreateTableData saves the table name and schema.
func (*CreateTableData) NewSchema ¶
func (c *CreateTableData) NewSchema() *record.Schema
NewSchema returns the schema of the new table.
func (*CreateTableData) TableName ¶
func (c *CreateTableData) TableName() string
TableName returns the name of the new table.
type CreateViewData ¶
type CreateViewData struct {
// contains filtered or unexported fields
}
CreateViewData is the data for the SQL "create view" statement.
func NewCreateViewData ¶
func NewCreateViewData(viewname string, qrydata *QueryData) *CreateViewData
NewCreateViewData saves the view name and its definition.
func (*CreateViewData) ViewDef ¶
func (c *CreateViewData) ViewDef() string
ViewDef returns the definition of the new view.
func (*CreateViewData) ViewName ¶
func (c *CreateViewData) ViewName() string
ViewName returns the name of the new view.
type DeleteData ¶
type DeleteData struct {
// contains filtered or unexported fields
}
DeleteData is the data for the SQL "delete" statement.
func NewDeleteData ¶
func NewDeleteData(tblname string, pred *query.Predicate) *DeleteData
NewDeleteData saves the table name and predicate.
func (*DeleteData) Pred ¶
func (d *DeleteData) Pred() *query.Predicate
Pred returns the predicate that describes which records should be deleted.
func (*DeleteData) TableName ¶
func (d *DeleteData) TableName() string
TableName returns the name of the affected table.
type InsertData ¶
type InsertData struct {
// contains filtered or unexported fields
}
InsertData is the data for the SQL "insert" statement.
func NewInsertData ¶
func NewInsertData(tblname string, flds []string, vals []*record.Constant) *InsertData
NewInsertData saves the table name and the field and value lists.
func (*InsertData) Fields ¶
func (i *InsertData) Fields() []string
Fields returns a list of fields for which values will be specified in the new record.
func (*InsertData) TableName ¶
func (i *InsertData) TableName() string
TableName returns the name of the affected table.
func (*InsertData) Vals ¶
func (i *InsertData) Vals() []*record.Constant
Vals returns a list of values for the specified fields. There is a one-one correspondence between this list of values and the list of fields.
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer is the lexical analyzer.
func (*Lexer) EatDelim ¶
eatDelim throws an exception if the current token is not the specified delimiter. Otherwise, moves to the next token.
func (*Lexer) EatId ¶
eatId throws an exception if the current token is not an identifier. Otherwise, returns the identifier string and moves to the next token.
func (*Lexer) EatIntConstant ¶
eatIntConstant throws an exception if the current token is not an integer. Otherwise, returns that integer and moves to the next token.
func (*Lexer) EatKeyword ¶
eatKeyword throws an exception if the current token is not the specified keyword. Otherwise, moves to the next token.
func (*Lexer) EatStringConstant ¶
eatStringConstant throws an exception if the current token is not a string. Otherwise, returns that string and moves to the next token.
func (*Lexer) MatchDelim ¶
matchDelim returns true if the current token is the specified delimiter character.
func (*Lexer) MatchKeyword ¶
matchKeyword returns true if the current token is the specified keyword.
func (*Lexer) MatchStringConstant ¶
matchStringConstant returns true if the current token is a string.
type ModifyData ¶
type ModifyData struct {
// contains filtered or unexported fields
}
ModifyData is the data for the SQL "update" statement.
func NewModifyData ¶
func NewModifyData(tblname, fldname string, newval *query.Expression, pred *query.Predicate) *ModifyData
NewModifyData saves the table name, the modified field and its new value, and the predicate.
func (*ModifyData) NewValue ¶
func (m *ModifyData) NewValue() *query.Expression
NewValue returns an expression. Evaluating this expression for a record produces the value that will be stored in the record's target field.
func (*ModifyData) Pred ¶
func (m *ModifyData) Pred() *query.Predicate
Pred returns the predicate that describes which records should be modified.
func (*ModifyData) TableName ¶
func (m *ModifyData) TableName() string
TableName returns the name of the affected table.
func (*ModifyData) TargetField ¶
func (m *ModifyData) TargetField() string
TargetField returns the field whose values will be modified.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is the SimpleDB parser.
func (*Parser) CreateIndex ¶
func (p *Parser) CreateIndex() *CreateIndexData
CreateIndex parses and returns a create index data.
func (*Parser) CreateTable ¶
func (p *Parser) CreateTable() *CreateTableData
CreateTable parses and returns a create table data.
func (*Parser) CreateView ¶
func (p *Parser) CreateView() *CreateViewData
CreateView parses and returns a create view data.
func (*Parser) Delete ¶
func (p *Parser) Delete() *DeleteData
Delete parses and returns a delete data.
func (*Parser) Expression ¶
func (p *Parser) Expression() *query.Expression
Expression parses and returns an expression.
func (*Parser) Insert ¶
func (p *Parser) Insert() *InsertData
Insert parses and returns an insert data.
func (*Parser) Modify ¶
func (p *Parser) Modify() *ModifyData
Modify parses and returns a modify data.
type PredParser ¶
type PredParser struct {
// contains filtered or unexported fields
}
func NewPredParser ¶
func NewPredParser(s string) *PredParser
func (*PredParser) Constant ¶
func (p *PredParser) Constant()
func (*PredParser) Expression ¶
func (p *PredParser) Expression()
func (*PredParser) Field ¶
func (p *PredParser) Field() string
func (*PredParser) Predicate ¶
func (p *PredParser) Predicate()
func (*PredParser) Term ¶
func (p *PredParser) Term()
type QueryData ¶
type QueryData struct {
// contains filtered or unexported fields
}
QueryData holds data for the SQL select statement.
func NewQueryData ¶
NewQueryData creates a new QueryData instance.
func (*QueryData) Pred ¶
Pred returns the predicate that describes which records should be in the output table.