Documentation ¶
Index ¶
- Constants
- func EncodeQuery(query *Query, w io.Writer) error
- func MakeQueryJoinMessage(join QueryJoin) *proto.QueryJoinMessage
- func MakeQueryMessage(query *Query) *proto.QueryMessage
- func MakeQueryPredicateMessage(predicate QueryPredicate) *proto.QueryPredicateMessage
- func MakeQueryRowJoinMessage(row QueryRowJoin) *proto.QueryRowJoinMessage
- func MakeQuerySelectMessage(querySelect QuerySelect) *proto.QuerySelectMessage
- func MakeQueryWhereMessage(queryWhere QueryWhere) *proto.QueryWhereMessage
- type CompileContext
- type ErrorCollectVisitor
- func (visitor *ErrorCollectVisitor) BadOpcode(opCode QueryOpCode)
- func (visitor *ErrorCollectVisitor) BadPredicateOpCode(predicate *QueryPredicate)
- func (visitor *ErrorCollectVisitor) BadPublicKey(hash crypto.PublicKeyHash)
- func (visitor *ErrorCollectVisitor) BadWhereOpCode(position int, where *QueryWhere)
- func (visitor *ErrorCollectVisitor) CollectError(err error)
- func (visitor *ErrorCollectVisitor) Error() error
- type NoDebugVisitor
- type NoJoinVisitor
- type NoSelectVisitor
- type PredicateValue
- type Query
- func (query *Query) Analyse() string
- func (query *Query) Equals(other *Query) bool
- func (query *Query) OpCodePanic()
- func (query *Query) PrettyPrint(w io.Writer) error
- func (query *Query) PrettyText() (string, error)
- func (query *Query) Validate(context ValidationContext) error
- func (query *Query) Visit(visitor QueryVisitor)
- type QueryAST
- func (ast *QueryAST) AddCryptoKey(publicKey string)
- func (ast *QueryAST) AddJoin()
- func (ast *QueryAST) AddJoinRow()
- func (ast *QueryAST) AddPredicateKey(key string)
- func (ast *QueryAST) AddPredicateKeyPlaceholder(begin int)
- func (ast *QueryAST) AddPredicateLiteral(literal string)
- func (ast *QueryAST) AddPredicateLiteralPlaceholder(begin int)
- func (ast *QueryAST) AddSelect()
- func (ast *QueryAST) Compile(context CompileContext) (*Query, error)
- func (ast *QueryAST) InitPredicate()
- func (ast *QueryAST) PopWhere()
- func (ast *QueryAST) PushWhere()
- func (ast *QueryAST) SetJoinKey(key string)
- func (ast *QueryAST) SetJoinKeyPlaceholder(begin int)
- func (ast *QueryAST) SetJoinRowKey(key string)
- func (ast *QueryAST) SetJoinRowKeyPlaceholder(begin int)
- func (ast *QueryAST) SetJoinValue(value string)
- func (ast *QueryAST) SetJoinValuePlaceholder(begin int)
- func (ast *QueryAST) SetLimit(limit string)
- func (ast *QueryAST) SetLimitPlaceholder(begin int)
- func (ast *QueryAST) SetPredicateCommand(command string)
- func (ast *QueryAST) SetTableName(key string)
- func (ast *QueryAST) SetTableNamePlaceholder(begin int)
- func (ast *QueryAST) SetWhereCommand(command string)
- func (ast *QueryAST) UsePredicateRowKey()
- type QueryJoin
- type QueryJoinAST
- type QueryOpCode
- type QueryParser
- func (t *QueryParser) AST() *node32
- func (t *QueryParser) Add(rule pegRule, begin, end, index uint32)
- func (p *QueryParser) Execute()
- func (p *QueryParser) Init()
- func (p *QueryParser) Parse(rule ...int) error
- func (t *QueryParser) PrettyPrintSyntaxTree(buffer string)
- func (t *QueryParser) Print()
- func (p *QueryParser) PrintSyntaxTree()
- func (p *QueryParser) Reset()
- func (t *QueryParser) Tokens() []token32
- func (t *QueryParser) Trim(length uint32)
- type QueryPredicate
- type QueryPredicateAST
- type QueryPredicateOpCode
- type QueryRowJoin
- type QueryRowJoinAST
- type QueryRowJoinValueAST
- type QuerySelect
- type QuerySelectAST
- type QueryVisitor
- type QueryWhere
- type QueryWhereAST
- type QueryWhereOpCode
- type ValidationContext
- type WhereStack
Constants ¶
View Source
const ( QUERY_NOP = QueryOpCode(iota) SELECT JOIN )
View Source
const ( WHERE_NOOP = QueryWhereOpCode(iota) AND OR PREDICATE )
View Source
const ( PREDICATE_NOP = QueryPredicateOpCode(iota) STR_EQ )
View Source
const ( MESSAGE_NOOP = uint32(iota) MESSAGE_SELECT MESSAGE_JOIN )
View Source
const ( MESSAGE_WHERE_NOOP = uint32(iota) MESSAGE_AND MESSAGE_OR MESSAGE_PREDICATE )
View Source
const ( MESSAGE_PREDICATE_NOOP = uint32(iota) MESSAGE_STR_EQ MESSAGE_STR_NEQ )
Variables ¶
This section is empty.
Functions ¶
func MakeQueryJoinMessage ¶
func MakeQueryJoinMessage(join QueryJoin) *proto.QueryJoinMessage
func MakeQueryMessage ¶
func MakeQueryMessage(query *Query) *proto.QueryMessage
func MakeQueryPredicateMessage ¶
func MakeQueryPredicateMessage(predicate QueryPredicate) *proto.QueryPredicateMessage
func MakeQueryRowJoinMessage ¶
func MakeQueryRowJoinMessage(row QueryRowJoin) *proto.QueryRowJoinMessage
func MakeQuerySelectMessage ¶
func MakeQuerySelectMessage(querySelect QuerySelect) *proto.QuerySelectMessage
func MakeQueryWhereMessage ¶
func MakeQueryWhereMessage(queryWhere QueryWhere) *proto.QueryWhereMessage
Types ¶
type CompileContext ¶ added in v0.19.0
type CompileContext struct {
Variables []interface{}
}
type ErrorCollectVisitor ¶
type ErrorCollectVisitor struct {
// contains filtered or unexported fields
}
func (*ErrorCollectVisitor) BadOpcode ¶
func (visitor *ErrorCollectVisitor) BadOpcode(opCode QueryOpCode)
func (*ErrorCollectVisitor) BadPredicateOpCode ¶
func (visitor *ErrorCollectVisitor) BadPredicateOpCode(predicate *QueryPredicate)
func (*ErrorCollectVisitor) BadPublicKey ¶
func (visitor *ErrorCollectVisitor) BadPublicKey(hash crypto.PublicKeyHash)
func (*ErrorCollectVisitor) BadWhereOpCode ¶
func (visitor *ErrorCollectVisitor) BadWhereOpCode(position int, where *QueryWhere)
func (*ErrorCollectVisitor) CollectError ¶
func (visitor *ErrorCollectVisitor) CollectError(err error)
func (*ErrorCollectVisitor) Error ¶
func (visitor *ErrorCollectVisitor) Error() error
type NoDebugVisitor ¶
type NoDebugVisitor struct{}
func (*NoDebugVisitor) VisitAST ¶
func (visitor *NoDebugVisitor) VisitAST(*QueryAST)
func (*NoDebugVisitor) VisitParser ¶
func (visitor *NoDebugVisitor) VisitParser(*QueryParser)
type NoJoinVisitor ¶
type NoJoinVisitor struct{}
func (*NoJoinVisitor) LeaveJoin ¶
func (visitor *NoJoinVisitor) LeaveJoin(*QueryJoin)
func (*NoJoinVisitor) VisitJoin ¶
func (visitor *NoJoinVisitor) VisitJoin(*QueryJoin)
func (*NoJoinVisitor) VisitRowJoin ¶
func (visitor *NoJoinVisitor) VisitRowJoin(int, *QueryRowJoin)
type NoSelectVisitor ¶
type NoSelectVisitor struct{}
func (*NoSelectVisitor) LeaveSelect ¶
func (visitor *NoSelectVisitor) LeaveSelect(*QuerySelect)
func (*NoSelectVisitor) LeaveWhere ¶
func (visitor *NoSelectVisitor) LeaveWhere(*QueryWhere)
func (*NoSelectVisitor) VisitPredicate ¶
func (visitor *NoSelectVisitor) VisitPredicate(*QueryPredicate)
func (*NoSelectVisitor) VisitSelect ¶
func (visitor *NoSelectVisitor) VisitSelect(*QuerySelect)
func (*NoSelectVisitor) VisitWhere ¶
func (visitor *NoSelectVisitor) VisitWhere(int, *QueryWhere)
type PredicateValue ¶ added in v0.19.0
func PredicateKey ¶ added in v0.19.0
func PredicateKey(entry crdt.EntryName) PredicateValue
func PredicateLiteral ¶ added in v0.19.0
func PredicateLiteral(point crdt.PointText) PredicateValue
type Query ¶
type Query struct { AST *QueryAST `json:"-"` Parser *QueryParser `json:"-"` OpCode QueryOpCode `json:",omitempty"` TableKey crdt.TableName Join QueryJoin `json:",omitempty"` Select QuerySelect `json:",omitempty"` PublicKeys []crypto.PublicKeyHash }
func ReadQueryMessage ¶
func ReadQueryMessage(message *proto.QueryMessage) (*Query, error)
func (*Query) OpCodePanic ¶
func (query *Query) OpCodePanic()
func (*Query) PrettyText ¶
func (*Query) Validate ¶
func (query *Query) Validate(context ValidationContext) error
func (*Query) Visit ¶
func (query *Query) Visit(visitor QueryVisitor)
type QueryAST ¶
type QueryAST struct { Command string TableKey *astVariable Select QuerySelectAST `json:",omitempty"` Join QueryJoinAST `json:",omitempty"` PublicKeys []*astVariable Placeholders []*astVariable WhereStack []*QueryWhereAST // contains filtered or unexported fields }
func (*QueryAST) AddCryptoKey ¶
func (*QueryAST) AddJoinRow ¶
func (ast *QueryAST) AddJoinRow()
func (*QueryAST) AddPredicateKey ¶
func (*QueryAST) AddPredicateKeyPlaceholder ¶ added in v0.19.0
func (*QueryAST) AddPredicateLiteral ¶
func (*QueryAST) AddPredicateLiteralPlaceholder ¶ added in v0.19.0
func (*QueryAST) InitPredicate ¶
func (ast *QueryAST) InitPredicate()
func (*QueryAST) SetJoinKey ¶
func (*QueryAST) SetJoinKeyPlaceholder ¶ added in v0.19.0
func (*QueryAST) SetJoinRowKey ¶
func (*QueryAST) SetJoinRowKeyPlaceholder ¶ added in v0.19.0
func (*QueryAST) SetJoinValue ¶
func (*QueryAST) SetJoinValuePlaceholder ¶ added in v0.19.0
func (*QueryAST) SetLimitPlaceholder ¶ added in v0.19.0
func (*QueryAST) SetPredicateCommand ¶
func (*QueryAST) SetTableName ¶
func (*QueryAST) SetTableNamePlaceholder ¶ added in v0.19.0
func (*QueryAST) SetWhereCommand ¶
func (*QueryAST) UsePredicateRowKey ¶
func (ast *QueryAST) UsePredicateRowKey()
type QueryJoin ¶
type QueryJoin struct {
Rows []QueryRowJoin `json:",omitempty"`
}
type QueryJoinAST ¶
type QueryJoinAST struct {
Rows []*QueryRowJoinAST `json:",omitempty"`
}
func (*QueryJoinAST) Compile ¶
func (ast *QueryJoinAST) Compile() (QueryJoin, error)
type QueryOpCode ¶
type QueryOpCode uint16
type QueryParser ¶
type QueryParser struct { QueryAST Buffer string Pretty bool // contains filtered or unexported fields }
func (*QueryParser) Execute ¶
func (p *QueryParser) Execute()
func (*QueryParser) Init ¶
func (p *QueryParser) Init()
func (*QueryParser) Parse ¶
func (p *QueryParser) Parse(rule ...int) error
func (*QueryParser) PrettyPrintSyntaxTree ¶
func (t *QueryParser) PrettyPrintSyntaxTree(buffer string)
func (*QueryParser) PrintSyntaxTree ¶
func (p *QueryParser) PrintSyntaxTree()
func (*QueryParser) Reset ¶
func (p *QueryParser) Reset()
type QueryPredicate ¶
type QueryPredicate struct { FunctionName string Values []PredicateValue IncludeRowKey bool `json:",omitempty"` }
func (QueryPredicate) IsEmpty ¶
func (pred QueryPredicate) IsEmpty() bool
func (QueryPredicate) Keys ¶
func (pred QueryPredicate) Keys() []crdt.EntryName
func (QueryPredicate) Literals ¶
func (pred QueryPredicate) Literals() []crdt.PointText
type QueryPredicateAST ¶
func (*QueryPredicateAST) Compile ¶
func (ast *QueryPredicateAST) Compile() (QueryPredicate, error)
type QueryPredicateOpCode ¶
type QueryPredicateOpCode uint16
type QueryRowJoin ¶
type QueryRowJoinAST ¶
type QueryRowJoinAST struct { RowKey *astVariable Values []QueryRowJoinValueAST `json:",omitempty"` }
type QueryRowJoinValueAST ¶ added in v0.19.0
type QueryRowJoinValueAST struct { Key *astVariable Value *astVariable }
type QuerySelect ¶
type QuerySelect struct { Where QueryWhere `json:",omitempty"` Limit uint32 `json:",omitempty"` }
func (QuerySelect) IsEmpty ¶
func (querySelect QuerySelect) IsEmpty() bool
type QuerySelectAST ¶
type QuerySelectAST struct { Where *QueryWhereAST `json:",omitempty"` Limit *astVariable }
func (*QuerySelectAST) Compile ¶
func (ast *QuerySelectAST) Compile() (QuerySelect, error)
type QueryVisitor ¶
type QueryVisitor interface {
// contains filtered or unexported methods
}
type QueryWhere ¶
type QueryWhere struct { OpCode QueryWhereOpCode `json:",omitempty"` Clauses []QueryWhere `json:",omitempty"` Predicate QueryPredicate `json:",omitempty"` }
func (QueryWhere) IsEmpty ¶
func (where QueryWhere) IsEmpty() bool
type QueryWhereAST ¶
type QueryWhereAST struct { Command string Clauses []*QueryWhereAST `json:",omitempty"` Predicate *QueryPredicateAST `json:",omitempty"` }
func (*QueryWhereAST) Compile ¶
func (ast *QueryWhereAST) Compile() (QueryWhere, error)
func (*QueryWhereAST) CompileClauses ¶
func (ast *QueryWhereAST) CompileClauses(out *QueryWhere) error
func (*QueryWhereAST) Configure ¶
func (ast *QueryWhereAST) Configure(where *QueryWhere) error
type QueryWhereOpCode ¶
type QueryWhereOpCode uint16
type ValidationContext ¶ added in v0.19.0
type ValidationContext struct {
Functions function.FunctionNamespace
}
type WhereStack ¶
type WhereStack struct {
// contains filtered or unexported fields
}
func MakeWhereStack ¶
func MakeWhereStack(where *QueryWhere) *WhereStack
func (*WhereStack) Visit ¶
func (stack *WhereStack) Visit(visitor whereVisitor)
Click to show internal directories.
Click to hide internal directories.