query

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpSelect = iota
	OpDelete
)

Variables

This section is empty.

Functions

func EvalQuery

func EvalQuery(query *Query, stmts []*pb.Statement) ([]interface{}, error)

query evaluation: very primitive eval with only simple statements will have to do until we have an index and we can compile to sql.

func StatementRefs

func StatementRefs(stmt *pb.Statement) []string

func StatementSource

func StatementSource(stmt *pb.Statement) string

Types

type CompoundCriteria

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

type CompoundCriteriaFilter

type CompoundCriteriaFilter func(stmt *pb.Statement, left, right StatementFilter) bool

type CompoundResultSet

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

type CompoundSelector

type CompoundSelector []SimpleSelector

type ConsCell

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

type FunctionResultSet

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

type FunctionSelector

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

type FunctionStatementSelector

type FunctionStatementSelector func([]interface{}) []interface{}

type IndexCriteria

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

type IndexCriteriaFilterSelect

type IndexCriteriaFilterSelect func(*pb.Statement) []string

type MakeSimpleRowSelector

type MakeSimpleRowSelector func() SimpleRowSelector

type NegatedCriteria

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

type ParseState

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

type Query

type Query struct {
	Op int
	// contains filtered or unexported fields
}

func ParseQuery

func ParseQuery(qs string) (*Query, error)

query parsing

func (*Query) IsSimpleSelect

func (q *Query) IsSimpleSelect(sel string) bool

func (*Query) WithLimit

func (q *Query) WithLimit(limit int) *Query

func (*Query) WithSimpleSelect

func (q *Query) WithSimpleSelect(sel string) *Query

type QueryCompileError

type QueryCompileError string

func (QueryCompileError) Error

func (e QueryCompileError) Error() string

type QueryCriteria

type QueryCriteria interface {
	// contains filtered or unexported methods
}

type QueryEvalError

type QueryEvalError string

func (QueryEvalError) Error

func (e QueryEvalError) Error() string

type QueryOrder

type QueryOrder []*QueryOrderSpec

type QueryOrderSpec

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

type QueryParser

type QueryParser struct {
	*ParseState

	Buffer string

	Parse  func(rule ...int) error
	Reset  func()
	Pretty bool
	// contains filtered or unexported fields
}

func (*QueryParser) AST

func (t *QueryParser) AST() *node32

func (*QueryParser) Add

func (t *QueryParser) Add(rule pegRule, begin, end, depth uint32, index int)

func (*QueryParser) Error

func (t *QueryParser) Error() []token32

func (*QueryParser) Execute

func (p *QueryParser) Execute()

func (*QueryParser) Expand

func (t *QueryParser) Expand(index int)

func (*QueryParser) Highlighter

func (p *QueryParser) Highlighter()

func (*QueryParser) Init

func (p *QueryParser) Init()

func (*QueryParser) Order

func (t *QueryParser) Order() [][]token32

func (*QueryParser) PreOrder

func (t *QueryParser) PreOrder() (<-chan state32, [][]token32)

func (*QueryParser) Print

func (t *QueryParser) Print()

func (*QueryParser) PrintSyntax

func (t *QueryParser) PrintSyntax()

func (*QueryParser) PrintSyntaxTree

func (p *QueryParser) PrintSyntaxTree()

func (*QueryParser) Tokens

func (t *QueryParser) Tokens() <-chan token32

type QueryResultSet

type QueryResultSet interface {
	// contains filtered or unexported methods
}

type QuerySelector

type QuerySelector interface {
	// contains filtered or unexported methods
}

type RangeCriteria

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

type RangeCriteriaFilterCompare

type RangeCriteriaFilterCompare func(a, b int64) bool

type RangeCriteriaFilterSelect

type RangeCriteriaFilterSelect func(*pb.Statement) int64

type RowScanner

type RowScanner interface {
	Scan(res ...interface{}) error
}

Common Scan interface between sql.Row and sql.Rows

type RowSelectBody

type RowSelectBody struct {
	RowSelectStatement
}

func (*RowSelectBody) Scan

func (rs *RowSelectBody) Scan(src RowScanner) (interface{}, error)

type RowSelectCompound

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

func (*RowSelectCompound) Scan

func (rs *RowSelectCompound) Scan(src RowScanner) (interface{}, error)

type RowSelectInt

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

func (*RowSelectInt) Scan

func (rs *RowSelectInt) Scan(src RowScanner) (interface{}, error)

type RowSelectInt64

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

func (*RowSelectInt64) Scan

func (rs *RowSelectInt64) Scan(src RowScanner) (interface{}, error)

type RowSelectNullInt64

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

func (*RowSelectNullInt64) Scan

func (rs *RowSelectNullInt64) Scan(src RowScanner) (interface{}, error)

type RowSelectStatement

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

func (*RowSelectStatement) Scan

func (rs *RowSelectStatement) Scan(src RowScanner) (interface{}, error)

type RowSelectString

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

func (*RowSelectString) Scan

func (rs *RowSelectString) Scan(src RowScanner) (interface{}, error)

type RowSelector

type RowSelector interface {
	Scan(src RowScanner) (interface{}, error)
}

A RowSelector extracts the next value from an sql result set

func CompileQuery

func CompileQuery(q *Query) (string, RowSelector, error)

CompileQuery compiles a query to sql. Returns the compiled sql query and a selector for extracting values from an sql result set Note: The row selector should be used in single-threaded context

type SimpleResultSet

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

type SimpleRowSelector

type SimpleRowSelector interface {
	RowSelector
	// contains filtered or unexported methods
}

type SimpleSelector

type SimpleSelector string

type StatementFilter

type StatementFilter func(*pb.Statement) bool

type StatementSelector

type StatementSelector func(*pb.Statement) interface{}

type ValueCriteria

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

type ValueCriteriaFilterCompare

type ValueCriteriaFilterCompare func(a, b string) bool

type ValueCriteriaFilterSelect

type ValueCriteriaFilterSelect func(*pb.Statement) string

Jump to

Keyboard shortcuts

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