xpaging

package
v0.39.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaginatedResponse

type PaginatedResponse[C any] struct {
	Items         []C `json:"items"`
	PagingOptions `json:",inline"`
	Total         int64 `json:"total"`
}

type PagingOptions

type PagingOptions struct {
	Offset int64 `query:"offset" json:"offset" validate:"min=0"`
	Limit  int64 `query:"limit"  json:"limit" validate:"min=0,max=100"`
}

func (PagingOptions) Normalized

func (po PagingOptions) Normalized() PagingOptions

func (PagingOptions) Validate

func (po PagingOptions) Validate() error

type SortDirection

type SortDirection int
const (
	DirectionAsc  SortDirection = 1
	DirectionDesc SortDirection = -1
)

type SortEntry

type SortEntry struct {
	FieldName string
	Direction SortDirection
}

func NewSortEntry

func NewSortEntry(fieldName string, direction SortDirection) SortEntry

func NewSortEntryFromString

func NewSortEntryFromString(fieldName string, order string) SortEntry

type SortOptions

type SortOptions []SortEntry

func NewSortOptionsFromString

func NewSortOptionsFromString(sorts string, defaultOption ...string) (SortOptions, error)

func (SortOptions) IsEmpty

func (s SortOptions) IsEmpty() bool

Jump to

Keyboard shortcuts

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