pilosa: github.com/pilosa/pilosa/pql Index | Files

package pql

import "github.com/pilosa/pilosa/pql"

Package pql defines the Pilosa Query Language.

Index

Package Files

ast.go doc.go parser.go pql.peg.go token.go

func CopyArgs Uses

func CopyArgs(m map[string]interface{}) map[string]interface{}

CopyArgs returns a copy of m.

func IsReservedArg Uses

func IsReservedArg(name string) bool

func NewParser Uses

func NewParser(r io.Reader) *parser

NewParser returns a new instance of Parser.

type Call Uses

type Call struct {
    Name     string
    Args     map[string]interface{}
    Children []*Call
}

Call represents a function call in the AST.

func (*Call) BoolArg Uses

func (c *Call) BoolArg(key string) (bool, bool, error)

BoolArg is for reading the value at key from call.Args as a bool. If the key is not in Call.Args, the value of the returned bool will be false, and the error will be nil. The value is assumed to be a bool. An error is returned if the value is not a bool.

func (*Call) CallArg Uses

func (c *Call) CallArg(key string) (*Call, bool, error)

CallArg is for reading the value at key from call.Args as a Call. If the key is not in Call.Args, the value of the returned value will be nil, and the error will be nil. An error is returned if the value is not a Call.

func (*Call) Clone Uses

func (c *Call) Clone() *Call

Clone returns a copy of c.

func (*Call) FieldArg Uses

func (c *Call) FieldArg() (string, error)

FieldArg determines which key-value pair contains the field and rowID, in the case of arguments like Set(colID, field=rowID). Returns the field as a string if present, or an error if not.

func (*Call) HasConditionArg Uses

func (c *Call) HasConditionArg() bool

HasConditionArg returns true if any arg is a conditional.

func (*Call) IntArg Uses

func (c *Call) IntArg(key string) (int64, bool, error)

IntArg is for reading the value at key from call.Args as an int64. If the key is not in Call.Args, the value of the returned bool will be false, and the error will be nil. The value is assumed to be a unt64 or an int64 and then cast to an int64. An error is returned if the value is not an int64 or uint64.

func (*Call) String Uses

func (c *Call) String() string

String returns the string representation of the call.

func (*Call) UintArg Uses

func (c *Call) UintArg(key string) (uint64, bool, error)

UintArg is for reading the value at key from call.Args as a uint64. If the key is not in Call.Args, the value of the returned bool will be false, and the error will be nil. The value is assumed to be a uint64 or an int64 and then cast to a uint64. An error is returned if the value is not an int64 or uint64.

func (*Call) UintSliceArg Uses

func (c *Call) UintSliceArg(key string) ([]uint64, bool, error)

UintSliceArg reads the value at key from call.Args as a slice of uint64. If the key is not in Call.Args, the value of the returned bool will be false, and the error will be nil. If the value is a slice of int64 it will convert it to []uint64. Otherwise, if it is not a []uint64 it will return an error.

type Condition Uses

type Condition struct {
    Op    Token
    Value interface{}
}

Condition represents an operation & value. When used in an argument map it represents a binary expression.

func (*Condition) IntSliceValue Uses

func (cond *Condition) IntSliceValue() ([]int64, error)

IntSliceValue reads cond.Value as a slice of uint64. If the value is a slice of uint64 it will convert it to []int64. Otherwise, if it is not a []int64 it will return an error.

func (*Condition) String Uses

func (cond *Condition) String() string

String returns the string representation of the condition.

type PQL Uses

type PQL struct {
    Query

    Buffer string

    Pretty bool
    // contains filtered or unexported fields
}

func (*PQL) AST Uses

func (t *PQL) AST() *node32

func (*PQL) Add Uses

func (t *PQL) Add(rule pegRule, begin, end, index uint32)

func (*PQL) Execute Uses

func (p *PQL) Execute()

func (*PQL) Init Uses

func (p *PQL) Init()

func (*PQL) Parse Uses

func (p *PQL) Parse(rule ...int) error

func (*PQL) PrettyPrintSyntaxTree Uses

func (t *PQL) PrettyPrintSyntaxTree(buffer string)

func (*PQL) Print Uses

func (t *PQL) Print()

func (*PQL) PrintSyntaxTree Uses

func (p *PQL) PrintSyntaxTree()

func (*PQL) Reset Uses

func (p *PQL) Reset()

func (*PQL) Tokens Uses

func (t *PQL) Tokens() []token32

func (*PQL) Trim Uses

func (t *PQL) Trim(length uint32)

type Query Uses

type Query struct {
    Calls []*Call
    // contains filtered or unexported fields
}

Query represents a PQL query.

func ParseString Uses

func ParseString(s string) (*Query, error)

ParseString parses s into a query.

func (*Query) String Uses

func (q *Query) String() string

String returns a string representation of the query.

func (*Query) WriteCallN Uses

func (q *Query) WriteCallN() int

WriteCallN returns the number of mutating calls.

type Token Uses

type Token int

Token is a lexical token of the PQL language.

const (
    // Special tokens
    ILLEGAL Token = iota

    ASSIGN  // =
    EQ      // ==
    NEQ     // !=
    LT      // <
    LTE     // <=
    GT      // >
    GTE     // >=
    BETWEEN // ><
)

func (Token) String Uses

func (tok Token) String() string

String returns the string representation of the token.

Package pql imports 10 packages (graph) and is imported by 10 packages. Updated 2019-10-14. Refresh now. Tools for package owners.