dto

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 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 BaseResponse

type BaseResponse struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

type BizRequest

type BizRequest struct {
	BizId int64 `json:"bizId" form:"bizId" uri:"bizId"`
}

BizRequest default business tag reqquest

func (*BizRequest) GetBizId

func (r *BizRequest) GetBizId() int64

func (*BizRequest) ToUrlQuery

func (r *BizRequest) ToUrlQuery() url.Values

type DataPager

type DataPager struct {
	Data interface{} `json:"data"`
	Pager
}

Deprecate : 后期启用

func NewDataPager

func NewDataPager(data interface{}, index, size int64, total int64) *DataPager

Deprecate : 后期启用

type IRow added in v0.0.14

type IRow interface {
	ToRow() []string
}

type Page

type Page struct {
	PageIndex int64       `json:"page" form:"page" uri:"page" binding:"required,gte=1"`             // currect page no
	AfterId   interface{} `json:"afterId"`                                                          // previous page last id, when sort by pk
	PageSize  int64       `json:"pageSize" form:"pageSize" uri:"pageSize" binding:"required,gte=1"` // page size
	Sorts     []string    `json:"sorts" form:"sorts" uri:"sorts"`                                   // eg; field|desc
}

Page default page request

func (*Page) GetAfterID

func (dto *Page) GetAfterID() any

func (*Page) GetBegin

func (dto *Page) GetBegin() int64

func (*Page) GetPageIndex

func (dto *Page) GetPageIndex() int64

func (*Page) GetPageSize

func (dto *Page) GetPageSize() int64

func (*Page) GetSize

func (dto *Page) GetSize() int64

func (*Page) GetSorts

func (dto *Page) GetSorts() []dependency.ISortField

type Pager

type Pager struct {
	Page
	TotalRecord int64 `json:"total"`
	TotalPage   int64 `json:"totalPage"`
}

func (Pager) GetTotal added in v0.0.14

func (r Pager) GetTotal() int64

func (Pager) GetTotalRecord added in v0.0.18

func (r Pager) GetTotalRecord() int64

func (*Pager) Paginator

func (p *Pager) Paginator() *Pager

type Range

type Range struct {
	Beg int64 `json:"beg" form:"beg"`
	End int64 `json:"end" form:"end"`
}

Range range

func (*Range) GetBeg

func (i *Range) GetBeg() int64

func (*Range) GetEnd

func (i *Range) GetEnd() int64

type RecordPager added in v0.0.14

type RecordPager[T IRow] struct {
	Data []T `json:"data"`
	Pager
}

func NewRecordPager added in v0.0.14

func NewRecordPager[T IRow](index, size int64, total int64, records ...T) *RecordPager[T]

func (RecordPager[T]) ToRows added in v0.0.17

func (r RecordPager[T]) ToRows() [][]string

type Response

type Response struct {
	BaseResponse
	Data interface{} `json:"data"`
}

func ErrorResponse

func ErrorResponse(err error) *Response

func NewResponse

func NewResponse(data interface{}, ex exception.Exception) *Response

func OkResponse

func OkResponse(data interface{}) *Response

type SortField

type SortField struct {
	Field  string `json:"field" form:"field"`   // order by col
	IsDesc bool   `json:"isDesc" form:"isDesc"` // asc or desc, default is asc
}

SortField default sort field

func (*SortField) GetField

func (r *SortField) GetField() string

func (*SortField) GetIsDesc

func (r *SortField) GetIsDesc() bool

Jump to

Keyboard shortcuts

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