filter

package
v1.0.0-beta.222 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	// Validate validates the filter.
	Validate() error
	// ValidateWithComplexity validates the complexity of the filter.
	ValidateWithComplexity(maxDepth int) error
	// SelectWhereExpr converts the filter to a SQL WHERE expression.
	SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string
	// IsEmpty returns true if the filter is empty.
	IsEmpty() bool
}

Filter is a filter for a field.

type FilterBoolean

type FilterBoolean struct {
	Eq *bool `json:"$eq,omitempty"`
}

FilterBoolean is a filter for a boolean field.

func (FilterBoolean) IsEmpty

func (f FilterBoolean) IsEmpty() bool

IsEmpty returns true if the filter is empty.

func (FilterBoolean) SelectWhereExpr

func (f FilterBoolean) SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string

SelectWhereExpr converts the filter to a SQL WHERE expression.

func (FilterBoolean) Validate

func (f FilterBoolean) Validate() error

Validate validates the filter.

func (FilterBoolean) ValidateWithComplexity

func (f FilterBoolean) ValidateWithComplexity(maxDepth int) error

ValidateWithComplexity validates the filter complexity.

type FilterFloat

type FilterFloat struct {
	Eq  *float64       `json:"$eq,omitempty"`
	Ne  *float64       `json:"$ne,omitempty"`
	Gt  *float64       `json:"$gt,omitempty"`
	Gte *float64       `json:"$gte,omitempty"`
	Lt  *float64       `json:"$lt,omitempty"`
	Lte *float64       `json:"$lte,omitempty"`
	And *[]FilterFloat `json:"$and,omitempty"`
	Or  *[]FilterFloat `json:"$or,omitempty"`
}

FilterFloat is a filter for a float field.

func (FilterFloat) IsEmpty

func (f FilterFloat) IsEmpty() bool

IsEmpty returns true if the filter is empty.

func (FilterFloat) SelectWhereExpr

func (f FilterFloat) SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string

SelectWhereExpr converts the filter to a SQL WHERE expression.

func (FilterFloat) Validate

func (f FilterFloat) Validate() error

func (FilterFloat) ValidateWithComplexity

func (f FilterFloat) ValidateWithComplexity(maxDepth int) error

ValidateWithComplexity validates the filter complexity.

type FilterInteger

type FilterInteger struct {
	Eq  *int             `json:"$eq,omitempty"`
	Ne  *int             `json:"$ne,omitempty"`
	Gt  *int             `json:"$gt,omitempty"`
	Gte *int             `json:"$gte,omitempty"`
	Lt  *int             `json:"$lt,omitempty"`
	Lte *int             `json:"$lte,omitempty"`
	And *[]FilterInteger `json:"$and,omitempty"`
	Or  *[]FilterInteger `json:"$or,omitempty"`
}

FilterInteger is a filter for an integer field.

func (FilterInteger) IsEmpty

func (f FilterInteger) IsEmpty() bool

IsEmpty returns true if the filter is empty.

func (FilterInteger) SelectWhereExpr

func (f FilterInteger) SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string

SelectWhereExpr converts the filter to a SQL WHERE expression.

func (FilterInteger) Validate

func (f FilterInteger) Validate() error

Validate validates the filter.

func (FilterInteger) ValidateWithComplexity

func (f FilterInteger) ValidateWithComplexity(maxDepth int) error

ValidateWithComplexity validates the filter complexity.

type FilterString

type FilterString struct {
	Eq     *string         `json:"$eq,omitempty"`
	Ne     *string         `json:"$ne,omitempty"`
	In     *[]string       `json:"$in,omitempty"`
	Nin    *[]string       `json:"$nin,omitempty"`
	Like   *string         `json:"$like,omitempty"`
	Nlike  *string         `json:"$nlike,omitempty"`
	Ilike  *string         `json:"$ilike,omitempty"`
	Nilike *string         `json:"$nilike,omitempty"`
	Gt     *string         `json:"$gt,omitempty"`
	Gte    *string         `json:"$gte,omitempty"`
	Lt     *string         `json:"$lt,omitempty"`
	Lte    *string         `json:"$lte,omitempty"`
	And    *[]FilterString `json:"$and,omitempty"`
	Or     *[]FilterString `json:"$or,omitempty"`
}

FilterString is a filter for a string field.

func (FilterString) IsEmpty

func (f FilterString) IsEmpty() bool

IsEmpty returns true if the filter is empty.

func (FilterString) SelectWhereExpr

func (f FilterString) SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string

SelectWhereExpr converts the filter to a SQL WHERE expression.

func (FilterString) Validate

func (f FilterString) Validate() error

Validate validates the filter.

func (FilterString) ValidateWithComplexity

func (f FilterString) ValidateWithComplexity(maxDepth int) error

ValidateWithComplexity validates the filter complexity.

type FilterTime

type FilterTime struct {
	Gt  *time.Time    `json:"$gt,omitempty"`
	Gte *time.Time    `json:"$gte,omitempty"`
	Lt  *time.Time    `json:"$lt,omitempty"`
	Lte *time.Time    `json:"$lte,omitempty"`
	And *[]FilterTime `json:"$and,omitempty"`
	Or  *[]FilterTime `json:"$or,omitempty"`
}

FilterTime is a filter for a time field.

func (FilterTime) IsEmpty

func (f FilterTime) IsEmpty() bool

IsEmpty returns true if the filter is empty.

func (FilterTime) SelectWhereExpr

func (f FilterTime) SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string

SelectWhereExpr converts the filter to a SQL WHERE expression.

func (FilterTime) Validate

func (f FilterTime) Validate() error

Validate validates the filter.

func (FilterTime) ValidateWithComplexity

func (f FilterTime) ValidateWithComplexity(maxDepth int) error

ValidateWithComplexity validates the filter complexity.

Jump to

Keyboard shortcuts

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