api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AES

func AES(ctx context.Context, data any) (str string)

func MiddlewareHandlerResponse

func MiddlewareHandlerResponse(r *ghttp.Request)

MiddlewareHandlerResponse is the default middleware handling handler response object and its error.

func SetIsAll

func SetIsAll(tx *gdb.Model, in *PageLstReq) (result *gdb.Model)

func SetOrder

func SetOrder(tx *gdb.Model, in *PageLstReq) (result *gdb.Model)

func SetSimple

func SetSimple(tx *gdb.Model, in *PageLstReq) (result *gdb.Model)

Types

type DefaultHandlerResponse

type DefaultHandlerResponse struct {
	Code    int         `json:"code"    dc:"Error code"`
	Message string      `json:"message" dc:"Error message"`
	Details interface{} `json:"details,omitempty" dc:"Error details"`
	Data    interface{} `json:"data"    dc:"Result data for certain request according API definition"`
}

DefaultHandlerResponse is the default implementation of HandlerResponse.

type PageLstReq

type PageLstReq struct {
	Page     int         `p:"page" v:"page @integer|min:1#页码必填" d:"1" dc:"页码"`            // 页码
	LimitNum int         `p:"limit" v:"pageSize @integer|min:1#每页数量必填"  d:"10" dc:"每页数量"` // 每页数量
	Keywords string      `p:"keywords" dc:"模糊搜索内容"`                                       // 搜索内容
	Wheres   *gjson.Json `p:"wheres" dc:"搜索条件" d:"{}"`
	Order    *gjson.Json `p:"order" dc:"排序条件" d:"{}"`
}

func NewPageLstReq

func NewPageLstReq() *PageLstReq

func (*PageLstReq) Limit

func (r *PageLstReq) Limit() int

func (*PageLstReq) Offset

func (r *PageLstReq) Offset() int

func (*PageLstReq) SearchStr

func (r *PageLstReq) SearchStr() string

func (*PageLstReq) SearchStrM

func (r *PageLstReq) SearchStrM() string

func (*PageLstReq) SearchStrOther

func (r *PageLstReq) SearchStrOther(str string) string

type PageLstRes

type PageLstRes[T any] struct {
	Total int `json:"total" dc:"总数"` // 总数
	List  []T `json:"list" dc:"列表"`  // 列表
}

func NewPageLstRes

func NewPageLstRes[T any]() *PageLstRes[T]

Jump to

Keyboard shortcuts

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