rest-layer: github.com/rs/rest-layer/schema/query Index | Files

package query

import "github.com/rs/rest-layer/schema/query"

Index

Package Files

parse.go query.go utils.go validate.go

type And Uses

type And []Expression

And joins query clauses with a logical AND, returns all documents that match the conditions of both clauses.

func (And) Match Uses

func (e And) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (And) String Uses

func (e And) String() string

String implements Expression interface.

func (And) Validate Uses

func (e And) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Equal Uses

type Equal struct {
    Field string
    Value Value
}

Equal matches all values that are equal to a specified value.

func (Equal) Match Uses

func (e Equal) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (Equal) String Uses

func (e Equal) String() string

String implements Expression interface.

func (Equal) Validate Uses

func (e Equal) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Exist Uses

type Exist struct {
    Field string
}

Exist matches all values which are present, even if nil

func (Exist) Match Uses

func (e Exist) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (Exist) String Uses

func (e Exist) String() string

String implements Expression interface.

func (Exist) Validate Uses

func (e Exist) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Expression Uses

type Expression interface {
    Match(payload map[string]interface{}) bool
    Validate(validator schema.Validator) error
    String() string
}

Expression is a query or query component that can be matched against a payload.

type GreaterOrEqual Uses

type GreaterOrEqual struct {
    Field string
    Value float64
}

GreaterOrEqual matches values that are greater than or equal to a specified value.

func (GreaterOrEqual) Match Uses

func (e GreaterOrEqual) Match(payload map[string]interface{}) bool

Match implements Expression interface

func (GreaterOrEqual) String Uses

func (e GreaterOrEqual) String() string

String implements Expression interface.

func (GreaterOrEqual) Validate Uses

func (e GreaterOrEqual) Validate(validator schema.Validator) error

Validate implements Expression interface.

type GreaterThan Uses

type GreaterThan struct {
    Field string
    Value float64
}

GreaterThan matches values that are greater than a specified value.

func (GreaterThan) Match Uses

func (e GreaterThan) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (GreaterThan) String Uses

func (e GreaterThan) String() string

String implements Expression interface.

func (GreaterThan) Validate Uses

func (e GreaterThan) Validate(validator schema.Validator) error

Validate implements Expression interface.

type In Uses

type In struct {
    Field  string
    Values []Value
}

In natches any of the values specified in an array.

func (In) Match Uses

func (e In) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (In) String Uses

func (e In) String() string

String implements Expression interface.

func (In) Validate Uses

func (e In) Validate(validator schema.Validator) error

Validate implements Expression interface.

type LowerOrEqual Uses

type LowerOrEqual struct {
    Field string
    Value float64
}

LowerOrEqual matches values that are less than or equal to a specified value.

func (LowerOrEqual) Match Uses

func (e LowerOrEqual) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (LowerOrEqual) String Uses

func (e LowerOrEqual) String() string

String implements Expression interface.

func (LowerOrEqual) Validate Uses

func (e LowerOrEqual) Validate(validator schema.Validator) error

Validate implements Expression interface.

type LowerThan Uses

type LowerThan struct {
    Field string
    Value float64
}

LowerThan matches values that are less than a specified value.

func (LowerThan) Match Uses

func (e LowerThan) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (LowerThan) String Uses

func (e LowerThan) String() string

String implements Expression interface.

func (LowerThan) Validate Uses

func (e LowerThan) Validate(validator schema.Validator) error

Validate implements Expression interface.

type NotEqual Uses

type NotEqual struct {
    Field string
    Value Value
}

NotEqual matches all values that are not equal to a specified value.

func (NotEqual) Match Uses

func (e NotEqual) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (NotEqual) String Uses

func (e NotEqual) String() string

String implements Expression interface.

func (NotEqual) Validate Uses

func (e NotEqual) Validate(validator schema.Validator) error

Validate implements Expression interface.

type NotExist Uses

type NotExist struct {
    Field string
}

NotExist matches all values which are absent

func (NotExist) Match Uses

func (e NotExist) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (NotExist) String Uses

func (e NotExist) String() string

String implements Expression interface.

func (NotExist) Validate Uses

func (e NotExist) Validate(validator schema.Validator) error

Validate implements Expression interface.

type NotIn Uses

type NotIn struct {
    Field  string
    Values []Value
}

NotIn matches none of the values specified in an array.

func (NotIn) Match Uses

func (e NotIn) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (NotIn) String Uses

func (e NotIn) String() string

String implements Expression interface.

func (NotIn) Validate Uses

func (e NotIn) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Or Uses

type Or []Expression

Or joins query clauses with a logical OR, returns all documents that match the conditions of either clause.

func (Or) Match Uses

func (e Or) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (Or) String Uses

func (e Or) String() string

String implements Expression interface.

func (Or) Validate Uses

func (e Or) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Query Uses

type Query []Expression

Query defines an expression against a schema to perform a match on schema's data.

func MustParse Uses

func MustParse(query string) Query

MustParse parses a query and panics in case of error.

func Parse Uses

func Parse(query string) (Query, error)

Parse parses a query.

func (Query) Match Uses

func (e Query) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (Query) String Uses

func (e Query) String() string

String implements Expression interface.

func (Query) Validate Uses

func (e Query) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Regex Uses

type Regex struct {
    Field string
    Value *regexp.Regexp
}

Regex matches values that match to a specified regular expression.

func (Regex) Match Uses

func (e Regex) Match(payload map[string]interface{}) bool

Match implements Expression interface.

func (Regex) String Uses

func (e Regex) String() string

String implements Expression interface.

func (Regex) Validate Uses

func (e Regex) Validate(validator schema.Validator) error

Validate implements Expression interface.

type Value Uses

type Value interface{}

Value represents any kind of value to use in query.

Package query imports 8 packages (graph) and is imported by 6 packages. Updated 2017-07-04. Refresh now. Tools for package owners.