load

package
v0.0.0-...-843cdbd Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPagingSize = 100
View Source
const FirstPage = 1
View Source
const MaxPagingSize = 2000

Variables

This section is empty.

Functions

This section is empty.

Types

type By

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

func NewBy

func NewBy() *By

func (*By) AllByCode

func (by *By) AllByCode() []string

func (*By) Do

func (by *By) Do(byCode ByCode) *errors.Error

func (*By) Register

func (by *By) Register(code ByCode, handle func() *errors.Error) *By

func (*By) Verify

func (by *By) Verify(code ByCode) *errors.Error

type ByCode

type ByCode = string

type Page

type Page struct {
	Size    int64 `json:"page_size"` // Page Size, default 100
	Current int64 `json:"page_no"`   // From One
}

func PageALL

func PageALL() *Page

type Pagination

type Pagination struct {
	Paging Paging `bson:"paging" json:"paging"`
	Items  []any  `bson:"items" json:"items"`
}

func PagingWrap

func PagingWrap[T any](paging Paging, arr []*T, wrap func(m *T) any) Pagination

type Paging

type Paging struct {
	Size      int64 `json:"page_size"`  // Page Size, default 100
	Current   int64 `json:"page_no"`    // From One
	Total     int64 `json:"page_total"` // The Page Count
	ItemTotal int64 `json:"item_total"` // The Item Count
}

func PagingALL

func PagingALL() Paging

func PagingOf

func PagingOf(size int64, current int64) Paging

func PagingOfPage

func PagingOfPage(page *Page) Paging

func (*Paging) Limit

func (paging *Paging) Limit() int64

func (*Paging) Skip

func (paging *Paging) Skip() int64

func (*Paging) ToString

func (paging *Paging) ToString() string

func (*Paging) WithItemTotal

func (paging *Paging) WithItemTotal(itemTotal int64)

Jump to

Keyboard shortcuts

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