filtering

package
v0.0.0-...-ddbe700 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFilter

func ParseFilter(messageType proto.Message, filterString string, query *firestore.Query) (*firestore.Query, error)

ParseFilter accepts a filtering.Request, which is an interface representing List method Request messages that have a GetFilter method which returns the filter specified in the request.

func TranspileFilterToQuery

func TranspileFilterToQuery(filter filtering.Filter, query *firestore.Query) (*firestore.Query, error)

TranspileFilterToQuery takes in a filter and an initial query for the firestore collection that is being queried and extends the query with the filter

Types

type DateEqual

type DateEqual struct {
	LHS string `json:"lhs"`
	RHS string `json:"rhs"`
}

type FilterParser

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

func New

func New(filter filtering.Filter) *FilterParser

New instantiate a new FilterParser for the given filter

func (*FilterParser) Parse

func (p *FilterParser) Parse() (interface{}, map[string]interface{}, error)

func (*FilterParser) Transpile

func (p *FilterParser) Transpile(query *firestore.Query, expression interface{}, params map[string]interface{}) (*firestore.Query, error)

Transpile takes in an AIP filter string and converts it to a firestore query

expression is a map and takes the structure map[LHS:interface{} OP:string RHS:interface{}]

Example:

map[string]interface{}{"LHS":"name" "OP":"=" "RHS":"param_0"}

params is a map and takes the structure map[param_${index}: interface{}]

Example:

map[string]interface{}{"param_0":"example name"}

Jump to

Keyboard shortcuts

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