repo_filter

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareFilters added in v0.0.17

func PrepareFilters(filters ...interface{}) []api_entity.GormFilter

Types

type Field

type Field struct {
	Field string
	Type  FilterType
	Value any
}

func (Field) ApplyTo

func (f Field) ApplyTo(c *gorm.DB) *gorm.DB

func (Field) Condition

func (f Field) Condition() string

func (Field) Values

func (f Field) Values() []any

type FilterType

type FilterType string
const (
	EQ      FilterType = "="
	NE      FilterType = "!="
	GE      FilterType = ">="
	GT      FilterType = ">"
	LE      FilterType = "<="
	LT      FilterType = "<"
	LIKE    FilterType = "LIKE"
	IN      FilterType = "IN"
	NOTIN   FilterType = "NOT IN"
	BETWEEN FilterType = "BETWEEN"
	NOTNULL FilterType = "IS NOT NULL"
)

type Pager

type Pager struct {
	Page  int
	Limit int
}

func (Pager) ApplyTo

func (p Pager) ApplyTo(c *gorm.DB) *gorm.DB

func (Pager) Condition

func (p Pager) Condition() string

func (Pager) Values

func (p Pager) Values() []any

type Raw added in v0.0.16

type Raw string

func (Raw) ApplyTo added in v0.0.16

func (r Raw) ApplyTo(c *gorm.DB) *gorm.DB

func (Raw) Condition added in v0.0.16

func (r Raw) Condition() string

func (Raw) Values added in v0.0.16

func (r Raw) Values() []interface{}

type Where

type Where struct {
	Cmd   string
	Value []any
}

func (Where) ApplyTo

func (w Where) ApplyTo(c *gorm.DB) *gorm.DB

func (Where) Condition

func (w Where) Condition() string

func (Where) Values

func (w Where) Values() []interface{}

Jump to

Keyboard shortcuts

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