filters

package
v2.38.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASC  = "ASC"  // ASC defines ascending sort direction.
	DESC = "DESC" // DESC defines descending sort direction.
)

Variables

This section is empty.

Functions

func Values

func Values(s interface{}) (url.Values, error)

Values convert struct into URL values by reflecting over its fields and tags.

Types

type Encoder

type Encoder interface {
	EncodeValues(key string, v *url.Values) error
}

Encoder is an interface implemented by any type that wishes to encode itself into URL values in a non-standard way.

type Option

type Option func(*url.Values)

Option function type setting url values.

func Filter

func Filter(filter string) Option

Filter sets the filter for url values.

func FuzzyCount

func FuzzyCount(fuzzycount bool) Option

FuzzyCount sets the fuzzy count for url values.

func Limit

func Limit(limit int) Option

Limit sets the limit for url values.

func Offset

func Offset(offset int) Option

Offset sets the offset for url values.

func Paging

func Paging(offset, limit int) Option

Paging sets both the offset and limit for url values.

func SetCustomParams

func SetCustomParams(key, value string) Option

SetCustomParams set custom key-value parameter pairs freely.

func SetStructParams

func SetStructParams(p interface{}) Option

SetStructParams convert struct to URL values and return Option from those values.

func Sort

func Sort(key, dir string) Option

Sort sets the sort key and direction for url values.

func SortAsc

func SortAsc(key string) Option

SortAsc sets the sort key with ascending order for url values.

func SortDesc

func SortDesc(key string) Option

SortDesc sets the sort key with descending order for url values.

Jump to

Keyboard shortcuts

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