filter

package
v1.7.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package filter contains types and methods for parsing and applying filters to resources being queried by a ListXXX request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

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

Filter represents a filter that can be applied when querying an arbitrary API resource.

func New

func New(filterProto *api.Filter) (*Filter, error)

New creates a new Filter from parsing the API filter protocol buffer.

func NewWithKeyMap

func NewWithKeyMap(filterProto *api.Filter, keyMap map[string]string, modelName string) (*Filter, error)

NewWithKeyMap is like New, but takes an additional map and model name for mapping key names in the protocol buffer to an appropriate name for use when querying the model. For example, if the API name of a field is "name", the model name is "pipelines", and the equivalent column name is "Name", then filterProto with predicates against key "name" will be parsed as if the key value was "pipelines.Name".

func (*Filter) AddToSelect

func (f *Filter) AddToSelect(sb squirrel.SelectBuilder) squirrel.SelectBuilder

AddToSelect builds a WHERE clause from the Filter f, adds it to the supplied SelectBuilder object and returns it for use in SQL queries.

func (*Filter) MarshalJSON

func (f *Filter) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON Marshaler for Filter.

func (*Filter) UnmarshalJSON

func (f *Filter) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON Unmarshaler for Filter.

Jump to

Keyboard shortcuts

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