model

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PaginationResultTransform added in v0.2.8

func PaginationResultTransform[Src any, Dst any](
	dst *PaginationResult[Dst], src *PaginationResult[Src],
	f func(dst *Dst, src *Src))

Types

type AppResponse

type AppResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func NewDataResponse

func NewDataResponse(data interface{}) AppResponse

func NewErrorCodeResponse

func NewErrorCodeResponse(err *errcode.Error) AppResponse

func NewErrorResponse

func NewErrorResponse(code int, err error) AppResponse

func NewOkResponse

func NewOkResponse() AppResponse

func TryErrorCodeResponse

func TryErrorCodeResponse(err error) AppResponse

type FormEntry added in v0.3.2

type FormEntry struct {
	Name  string
	Label string
	Hint  string
}

type JsonResponse added in v0.2.6

type JsonResponse map[string]interface{}

type PageParam

type PageParam struct {
	Page int `json:"page" bson:"page"` // Page is the page number, starts from 1
	Size int `json:"size" bson:"size"` // Size is the page size
}

type PageResult

type PageResult[T any] struct {
	Results   []T `json:"results" bson:"results"`
	PageNum   int `json:"page_num" bson:"page_num"`
	PageTotal int `json:"page_total" bson:"page_total"`
}

type PaginationParam

type PaginationParam struct {
	Offset int `json:"offset" bson:"offset"` // Page is the page number, starts from 0
	Limit  int `json:"limit" bson:"limit"`   // Size is the page size
}

PaginationParam is a *interface* struct provide interface for all common pagination parameter

type PaginationResult

type PaginationResult[T any] struct {
	Total   int64 `json:"total" bson:"total"`
	Offset  int64 `json:"offset" bson:"offset"`
	Results []T   `json:"results" bson:"results"`
	Count   int64 `json:"count" bson:"count"`
}

PaginationResult is a *interface* struct provide interface for all common pagination response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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