filter

package
v1.3.9 Latest Latest
Warning

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

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

Documentation

Overview

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

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

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

Index

Constants

View Source
const (
	PageSize = 100
	MaxRows  = 10000

	SuffixOrder      = ".o"
	SuffixLimit      = ".l"
	SuffixOffset     = ".x"
	SuffixDescending = ".d"
)

Variables

View Source
var AllowedColumns = map[string][]string{}
View Source
var OrderingFieldDescs = util.FieldDescs{
	{Key: "column", Title: "Column", Description: "The name of the column to sort by"},
	{Key: "asc", Title: "Ascending", Description: "Determines if this ordering is applied ascending or descending"},
}

Functions

This section is empty.

Types

type Ordering

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

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) Sanitized added in v1.2.9

func (s ParamSet) Sanitized(key string, logger util.Logger, defaultOrderings ...*Ordering) *Params

func (ParamSet) Specifies added in v1.0.7

func (s ParamSet) Specifies(key string) bool

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) IsDefault added in v1.0.7

func (p *Params) IsDefault() 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 *url.URL) string

func (*Params) WithLimit added in v0.8.22

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