filter

package
v1.0.0-beta.203 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 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
	// SelectWhereExpr converts the filter to a SQL WHERE expression.
	SelectWhereExpr(field string, q *sqlbuilder.SelectBuilder) string
}

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) 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.

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) 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

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) 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.

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) 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.

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) 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.

Jump to

Keyboard shortcuts

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