Documentation
¶
Index ¶
- func GetDSN(c common.MysqlConfigModule) string
- func InitAuditField[T any](entity T, name string) T
- func InitAuditFieldWhitJwt[T any](entity T, jwt common.JWTSession) T
- func InitUpdateAuditField[T any](entity T, name string) T
- func InitUpdateAuditFieldWhitJwt[T any](entity T, jwt common.JWTSession) T
- func PaginationGorm(page *Pagination) func(db *gorm.DB) *gorm.DB
- type Pagination
- type PaginationResult
- type RestFul
- type RestFulMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDSN ¶
func GetDSN(c common.MysqlConfigModule) string
func InitAuditField ¶ added in v0.0.5
func InitAuditFieldWhitJwt ¶ added in v0.0.5
func InitAuditFieldWhitJwt[T any](entity T, jwt common.JWTSession) T
func InitUpdateAuditField ¶ added in v0.0.5
func InitUpdateAuditFieldWhitJwt ¶ added in v0.0.5
func InitUpdateAuditFieldWhitJwt[T any](entity T, jwt common.JWTSession) T
func PaginationGorm ¶
func PaginationGorm(page *Pagination) func(db *gorm.DB) *gorm.DB
PaginationGorm 返回一个用于配置分页的Gorm处理器 此函数旨在与Gorm库一起使用,以实现数据库查询的分页功能 参数page是分页配置的指针,包含当前页和每页大小的信息 如果当前页设置为-1,则表示不分页,函数将返回nil 否则,函数将返回一个闭包,用于配置Gorm的Offset和Limit方法,以实现分页查询
Types ¶
type Pagination ¶
type Pagination struct {
Total int64 `json:"total"`
Current int `json:"current"`
PageSize int `json:"pageSize"`
}
func (*Pagination) Init ¶
func (p *Pagination) Init(total int64, current, pageSize int)
Init 初始化分页
total 总数 current 当前页 pageSize 每页数量
type PaginationResult ¶ added in v0.0.5
type RestFul ¶
type RestFul struct {
CodeConfig common.HttpCodeConfig
RestFulMsg RestFulMsg
}
func (*RestFul) GetJson ¶
func (r *RestFul) GetJson() RestFulMsg
func (*RestFul) SetMessage ¶
func (*RestFul) SetSuccess ¶
type RestFulMsg ¶
type RestFulMsg struct {
Success bool `json:"success"`
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
Info string `json:"info,omitempty"`
DateTime string `json:"dateTime,omitempty"`
Version string `json:"version,omitempty"`
Type string `json:"type,omitempty"`
}
func RestFulJson ¶ added in v0.0.18
func RestFulJson(data interface{}) RestFulMsg
func RestFulJsonFail ¶ added in v0.0.20
func RestFulJsonFail(err string, msg string) RestFulMsg
Click to show internal directories.
Click to hide internal directories.