dto

package
v0.0.0-...-e84d343 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLimit      = 10
	DefaultPage       = 1
	DefaultPagination = Pagination{
		Page: DefaultPage,
		Size: DefaultLimit,
	}
)

Functions

This section is empty.

Types

type FindAllBookOptions

type FindAllBookOptions struct {
	Title      string `form:"title"`
	Author     string `form:"author"`
	Pagination Pagination
	Search     string      `form:"search"`
	Sort       []SortQuery `form:"sort"`
}

func MergeFindAllBookOptions

func MergeFindAllBookOptions(opts ...FindAllBookOptions) FindAllBookOptions

type Pagination

type Pagination struct {
	Page int `form:"page"`
	Size int `form:"size" validate:"min=0"`
}

func (Pagination) Offset

func (p Pagination) Offset() int

type SortOrder

type SortOrder int
const (
	SortAcending  SortOrder = 1
	SortDecending SortOrder = -1
)

type SortQuery

type SortQuery string // e.g. "name" for ascending or "-name" for descending

func (SortQuery) BreakDown

func (sortQ SortQuery) BreakDown() (order SortOrder, field string)

func (SortQuery) String

func (sortQ SortQuery) String() string

Jump to

Keyboard shortcuts

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