filter

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Index

Constants

View Source
const MaxRowsDefault = 100

Variables

View Source
var AllowedColumns = map[string][]string{}

Functions

This section is empty.

Types

type Options

type Options struct {
	Sort   []string `json:"sort,omitempty"`
	Filter []string `json:"filter,omitempty"`
	Group  []string `json:"group,omitempty"`
	Search string   `json:"search,omitempty"`
	Params *Params  `json:"params,omitempty"`
}

type OptionsMap

type OptionsMap map[string]*Options

func (OptionsMap) Get

func (m OptionsMap) Get(key string) *Options

type Ordering

type Ordering struct {
	Column string `json:"column"`
	Asc    bool   `json:"asc"`
}

func (Ordering) String

func (o Ordering) String() string

type Orderings

type Orderings []*Ordering

type ParamSet

type ParamSet map[string]*Params

func (ParamSet) Get

func (s ParamSet) Get(key string, allowed []string, logger util.Logger) *Params

func (ParamSet) String

func (s ParamSet) String() string

type Params

type Params struct {
	Key       string    `json:"key"`
	Orderings Orderings `json:"orderings,omitempty"`
	Limit     int       `json:"limit,omitempty"`
	Offset    int       `json:"offset,omitempty"`
}

func ParamsWithDefaultOrdering

func ParamsWithDefaultOrdering(key string, params *Params, orderings ...*Ordering) *Params

func (*Params) CloneLimit

func (p *Params) CloneLimit(limit int) *Params

func (*Params) CloneOrdering

func (p *Params) CloneOrdering(orderings ...*Ordering) *Params

func (*Params) Filtered

func (p *Params) Filtered(available []string, logger util.Logger) *Params

func (*Params) GetOrdering

func (p *Params) GetOrdering(col string) *Ordering

func (*Params) HasNextPage

func (p *Params) HasNextPage(count int) bool

func (*Params) HasPreviousPage

func (p *Params) HasPreviousPage() bool

func (*Params) NextPage

func (p *Params) NextPage() *Params

func (*Params) OrderByString

func (p *Params) OrderByString() string

func (*Params) PreviousPage

func (p *Params) PreviousPage() *Params

func (*Params) Sanitize

func (p *Params) Sanitize(key string, defaultOrderings ...*Ordering) *Params

func (*Params) String

func (p *Params) String() string

func (*Params) ToQueryString

func (p *Params) ToQueryString(u *fasthttp.URI) string

func (*Params) WithLimit added in v0.2.12

func (p *Params) WithLimit(n int) *Params

Jump to

Keyboard shortcuts

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