paging

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PageDefinitionParameter

func PageDefinitionParameter() definition.Parameter

PageDefinitionParameter is used for apis/descriptors to define Definition's Parameter.

func ValidateListOption

func ValidateListOption(opts *ListOption) error

ValidateListOption is validating the ListOption.

Types

type ListMeta

type ListMeta struct {
	// Total number of items on the list. Used for pagination.
	TotalItems int `json:"totalItems"`
}

ListMeta describes list of objects, i.e. holds information about pagination options set for the list.

type ListOption

type ListOption struct {
	Start int  `source:"Query,start"`
	Limit *int `source:"Query,limit"`
}

ListOption is params in query which is used for paging.

type Result

type Result struct {
	ListMeta `json:"metadata"`
	Items    []interface{} `json:"items"`
}

func Page

func Page(items interface{}, opts *ListOption) Result

Page is page the input items datas.

Jump to

Keyboard shortcuts

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