filter

package
v0.0.0-...-50d7d3f Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IgnoreLimit  = -1
	IgnoreOffset = -1
)

Variables

This section is empty.

Functions

func DBUnscopedFilter

func DBUnscopedFilter(next http.Handler) http.Handler

func GetPreloadUnscoped

func GetPreloadUnscoped(ctx context.Context) bool

func GetUnscoped

func GetUnscoped(ctx context.Context) bool

func SetPreloadUnscoped

func SetPreloadUnscoped(ctx context.Context) context.Context

func SetUnscoped

func SetUnscoped(ctx context.Context) context.Context

Types

type BasicFilter

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

func NewBasicFilter

func NewBasicFilter() *BasicFilter

func (*BasicFilter) AddGroup

func (f *BasicFilter) AddGroup(query string) *BasicFilter

func (*BasicFilter) AddJoin

func (f *BasicFilter) AddJoin(join string, values ...interface{}) *BasicFilter

func (*BasicFilter) AddKey

func (f *BasicFilter) AddKey(key string) *BasicFilter

func (*BasicFilter) AddWhere

func (f *BasicFilter) AddWhere(key string, query string, values ...interface{}) *BasicFilter

func (*BasicFilter) GetGroups

func (f *BasicFilter) GetGroups() string

func (*BasicFilter) GetJoins

func (f *BasicFilter) GetJoins() []Join

func (*BasicFilter) GetKeys

func (f *BasicFilter) GetKeys() Keys

func (*BasicFilter) GetLimit

func (f *BasicFilter) GetLimit() int

func (*BasicFilter) GetOffset

func (f *BasicFilter) GetOffset() int

func (*BasicFilter) GetWhere

func (f *BasicFilter) GetWhere() Where

type BasicOrder

type BasicOrder struct {
	OrderBy []string `json:"orderBy"`
	// contains filtered or unexported fields
}

func NewBasicOrder

func NewBasicOrder() *BasicOrder

func (*BasicOrder) GetOrderBy

func (s *BasicOrder) GetOrderBy() []string

func (BasicOrder) SetOrderBy

func (s BasicOrder) SetOrderBy(mapObjectToFieldOrder map[string]string) []string

type Filter

type Filter interface {
	GetWhere() Where
	GetJoins() []Join
	GetLimit() int
	GetOffset() int
	GetOrderBy() []string
	GetKeys() Keys
	GetGroups() string
}

type Groups

type Groups map[string]bool

type Join

type Join struct {
	Query string
	Args  []interface{}
}

type Joins

type Joins struct {
	Queries []string
	Conds   map[string]Join
}

type Keys

type Keys map[string]bool

type PaginationFilter

type PaginationFilter struct {
	BasicFilter   `json:"basicFilter"`
	BasicOrder    `json:"basicOrder"`
	CheckNextPage bool `json:"checkNextPage"`
	Page          int  `json:"page"`
	PerPage       int  `json:"perPage"`
	IgnorePerPage bool `json:"ignorePerPage"`
}

func NewPaginationFilter

func NewPaginationFilter() *PaginationFilter

func (*PaginationFilter) GetLimit

func (f *PaginationFilter) GetLimit() int

func (*PaginationFilter) GetOffset

func (f *PaginationFilter) GetOffset() int

func (*PaginationFilter) GetPage

func (f *PaginationFilter) GetPage() int

func (*PaginationFilter) GetPerPage

func (f *PaginationFilter) GetPerPage() int

type Where

type Where map[string][]interface{}

Jump to

Keyboard shortcuts

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