query

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type All

type All bool

func (All) String

func (All) String() string

func (All) Type

func (All) Type() Type

type Comparsion

type Comparsion interface {
	Condition
	Identifier() Identifier
	Operator() Operator
	Value() Value
}

func Compare

func Compare(attr string, operator Operator, v interface{}) (Comparsion, error)

func Contains

func Contains(attr string, v interface{}) (Comparsion, error)

func EndWith

func EndWith(attr string, v interface{}) (Comparsion, error)

func IsEqual

func IsEqual(attr string, v interface{}) (Comparsion, error)

func IsGreater

func IsGreater(attr string, v interface{}) (Comparsion, error)

func IsGreaterOrEqual

func IsGreaterOrEqual(attr string, v interface{}) (Comparsion, error)

func IsLess

func IsLess(attr string, v interface{}) (Comparsion, error)

func IsLessOrEqual

func IsLessOrEqual(attr string, v interface{}) (Comparsion, error)

func IsNotEqual

func IsNotEqual(attr string, v interface{}) (Comparsion, error)

func StartWith

func StartWith(attr string, v interface{}) (Comparsion, error)

type Condition

type Condition interface {
	Node
	AND(Node) Condition
	OR(Node) Condition
}

type Identifier

type Identifier interface {
	Node
	Name() string
}

type Logical

type Logical Type
const (
	AND Logical = iota + 3
	OR
)

type LogicalCondition

type LogicalCondition interface {
	Condition
	Logical() Logical
	Left() Node
	Right() Node
}

func And

func And(left, right Node) LogicalCondition

func Or

func Or(left, right Node) LogicalCondition

type Node

type Node interface {
	Type() Type
	String() string
}

func Parse

func Parse(query string) (Node, error)

type Operator

type Operator Type
const (
	EQ Operator = iota + 7
	NE
	CO
	SW
	EW
	GT
	GE
	LT
	LE
)

type Prefix

type Prefix Type
const (
	NOT Prefix = iota + 16
	PR
	GROUP Prefix = 23
)

type PrefixCondition

type PrefixCondition interface {
	Condition
	Prefix() Prefix
	Right() Node
}

func Group

func Group(n Node) PrefixCondition

func Not

func Not(n Node) PrefixCondition

func Pr

type Query

type Query struct {
	From  int    `json:"from"`
	Size  int    `json:"size,omitempty"`
	Query string `json:"query"`
}

func (Query) Parse

func (qry Query) Parse() (Node, error)

type QueryResult

type QueryResult struct {
	From      int           `json:"from"`
	Size      int           `json:"size"`
	Count     int           `json:"count"`
	Result    []interface{} `json:"result,omitempty"`
	Timestamp time.Time     `json:"timestamp,omitempty"`
	Took      int64         `json:"millis,omitempty"`
}

func NewQueryResult

func NewQueryResult(query Query, result []interface{}, count int) *QueryResult

type Type

type Type int
const (
	ALL   Type = -1
	IDENT Type = iota + 17
	INT
	FLOAT
	BOOL
	STRING
)

type Value

type Value interface {
	Node
	Value() interface{}

	IntValue() (int64, bool)
	FloatValue() (float64, bool)
	BoolValue() (bool, bool)
	StringValue() (string, bool)
}

Jump to

Keyboard shortcuts

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