Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsErrDuplicated ¶
func IsErrNoRows ¶
Types ¶
type ListParams ¶
type ListParams struct {
Pagination *Pagination `json:"pagination"`
Sort []string `json:"sort,omitempty"`
}
func (*ListParams) GetPagination ¶
func (ps *ListParams) GetPagination() *Pagination
func (*ListParams) Order ¶
func (ps *ListParams) Order() (ss []string)
type ListResult ¶
type ListResult[T any] struct { Pagination *Pagination `json:"pagination"` Records []T `json:"records"` }
func QueryList ¶
func QueryList[T any](tx *GormDB, ps *ListParams) (_ *ListResult[T], err error)
type Meta ¶
type Meta struct {
Id string `gorm:"type:varchar(36);primaryKey" json:"id"`
CreatedAt time.Time `gorm:"autoCreateTime:milli" json:"createdAt"`
CreatedBy string `gorm:"type:varchar(36)" json:"createdBy"`
UpdatedAt time.Time `gorm:"autoUpdateTime:milli" json:"updatedAt,omitempty"`
UpdatedBy string `gorm:"type:varchar(36)" json:"updatedBy,omitempty"`
}
type Pagination ¶
type Pagination struct {
Page int `json:"current"`
PageSize int `json:"pageSize"`
TotalSize int `json:"total"`
TotalPage int `json:"totalPage"`
}
func (*Pagination) Limit ¶
func (p *Pagination) Limit() int
func (*Pagination) Offset ¶
func (p *Pagination) Offset() int
func (*Pagination) Total ¶
func (p *Pagination) Total(size int64) *Pagination
Click to show internal directories.
Click to hide internal directories.