listing

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFilter

func DecodeFilter(criteria ...filtering.FilterDecoder) func(*Decoder)

DecodeFilter set criteria to filter

func DecodeLimit

func DecodeLimit(limit int) func(*Decoder)

DecodeLimit set the paging limit default.

func DecodeMaxAllowedLimit

func DecodeMaxAllowedLimit(maxAllowed int) func(*Decoder)

DecodeMaxAllowedLimit set the max allowed limit default.

func DecodeSort

func DecodeSort(criteria ...sorting.Sort) func(*Decoder)

DecodeSort set criteria to sort

Types

type Decoder

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

A Decoder reads and decodes Listing values from url.Values.

func NewDecoder

func NewDecoder(params url.Values, opts ...func(*Decoder)) *Decoder

NewDecoder returns a new decoder that reads from params.

func (*Decoder) Decode

func (dec *Decoder) Decode(v *Listing) error

Decode reads the Params values from url params and stores it in the value pointed to by v.

type Listing

type Listing struct {
	Paging    paging.Paging        `json:"paging,omitempty"`
	Sorting   *sorting.Sorting     `json:"sorting,omitempty"`
	Filtering *filtering.Filtering `json:"filtering,omitempty"`
}

Listing holds the info to perform filtering, sorting and paging over a collection.

func (Listing) MarshalJSON

func (v Listing) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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