request

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateFilter

type DateFilter struct {
	DateBegin string `json:"dateBegin" explain:"起始时间"`
	DateEnd   string `json:"dateEnd" explain:"结束时间"`
	RangeEnum int    `json:"rangeEnum" explain:"1-今天,2-本周,3-本月,4-今年"`
}

func (*DateFilter) Scope

func (d *DateFilter) Scope() (time.Time, time.Time)

赋值本周期,并返回下周期日期

type DateRangeReq

type DateRangeReq[T ~string | time.Time] RangeReq[T]

type IPageReq

type IPageReq interface {
	PageNo() int
	PageSize() int
}

type IPageSortReq

type IPageSortReq interface {
	IPageReq
	ISortReq
}

type ISortReq

type ISortReq interface {
	Column() string
	Type() SortType
}

type ListReq

type ListReq[T Ordered] struct {
	PageSortReq
	*RangeReq[T]
}

func NewListReq

func NewListReq[T Ordered](pageNo, pageSize int) *ListReq[T]

func (*ListReq[T]) WithRange

func (req *ListReq[T]) WithRange(field string, start, end T, include bool) *ListReq[T]

func (*ListReq[T]) WithSort

func (req *ListReq[T]) WithSort(field string, typ SortType) *ListReq[T]

type Ordered

type Ordered interface {
	constraints.Ordered | time.Time
}

type PageReq

type PageReq struct {
	PageNo   int `json:"pageNo"`
	PageSize int `json:"pageSize"`
}

type PageSortReq

type PageSortReq struct {
	PageReq
	*SortReq
}

type Pagination

type Pagination struct {
	PageNo   uint32
	PageSize uint32
}

type RangeReq

type RangeReq[T constraints.Range] struct {
	RangeField string `json:"rangeField,omitempty"`
	RangeBegin T      `json:"rangeBegin,omitempty"`
	RangeEnd   T      `json:"rangeEnd,omitempty"`
	Include    bool   `json:"include,omitempty"`
}

type SortReq

type SortReq struct {
	SortField string   `json:"sortField,omitempty"`
	SortType  SortType `json:"sortType,omitempty"`
}

func (*SortReq) Column

func (receiver *SortReq) Column() string

func (*SortReq) Type

func (receiver *SortReq) Type() SortType

type SortType

type SortType int
const (
	SortTypeAsc SortType
	SortTypeDesc
)

Jump to

Keyboard shortcuts

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