filter

package
v0.0.0-...-9eea1c9 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadFilter = errors.New("invalid query filter")

ErrBadFilter is returned from Parse when it encounters an invalid filter expression.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name string
	Type Type
}

Column describe a column

type Field

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

Field is a type for simple expressions that simply access an attribute of the queried object. They're used for GROUP BYs.

func ParseField

func ParseField(s string) (f Field, err error)

ParseField parses a field expression (either an attrExpr or a selectorExpr).

func (Field) String

func (f Field) String() string

type ForeignKey

type ForeignKey struct {
	Table         *Table
	LocalColumn   string
	ForeignColumn string
}

ForeignKey describe a foreign key

type Predicate

type Predicate struct {
	Parameters int
	// contains filtered or unexported fields
}

Predicate represents a parsed filter predicate.

func Parse

func Parse(predicate string, tbl *Table, vals []interface{}) (p Predicate, err error)

Parse parses a predicate and returns an internal representation of the predicate or an error if it fails to parse.

func (Predicate) MarshalText

func (p Predicate) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface and returns a cleaned, canonical representation of the predicate.

func (Predicate) String

func (p Predicate) String() string

String returns a cleaned, canonical representation of the predicate.

type Table

type Table struct {
	Name        string
	Alias       string
	Columns     map[string]*Column
	ForeignKeys map[string]*ForeignKey
}

Table describe a table

type Type

type Type int

Type defines the value types in filter expressions.

const (
	Any Type = iota
	Bool
	String
	Integer
	Object
)

defines the value types in filter expressions.

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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