Documentation ¶
Index ¶
- Constants
- Variables
- type ApiError
- type GormJSON
- func (j *GormJSON) GormDBDataType(db *gorm.DB, _ *schema.Field) string
- func (j *GormJSON) GormDataType() string
- func (j *GormJSON) GormValue(_ context.Context, db *gorm.DB) clause.Expr
- func (j *GormJSON) MarshalJSON() ([]byte, error)
- func (j *GormJSON) Scan(value any) error
- func (j *GormJSON) String() string
- func (j *GormJSON) UnmarshalJSON(b []byte) error
- func (j *GormJSON) Value() (driver.Value, error)
- type MySQLError
- type Pager
- type Query
- type RedisError
- type Result
- func (r *Result) SetAttr(key string, value any) *Result
- func (r *Result) SetError(err error) *Result
- func (r *Result) SetItem(item any) *Result
- func (r *Result) SetItems(items any) *Result
- func (r *Result) SetMessage(message string) *Result
- func (r *Result) SetPagerItems(pager *Pager, items any) *Result
- func (r *Result) SetSummPagerItems(pager *Pager, summ any, items any) *Result
Constants ¶
View Source
const ( GormContext string = "Ctx_Gorm" // Gorm Context 标识 GinContext string = "Ctx_Gin" // Gin Context 标识 )
Context 标识定义
View Source
const ( GinTime = "Gin_Time" // Gin请求时间,服务端接收到请求时间 GinBody = "Gin_Body" // Gin请求内容,请求体解密后内容 GinData = "Gin_Data" // Gin请求内容,请求体原始内容,未解密 GinLogger = "Gin_Log" // 是否记录请求日志 GinEncrypt = "Gin_Aes" // 是否进行AES加密 GinUserID = "Gin_Uid" // 当前请求用户ID )
Gin 标识定义
View Source
const ( GinSignError int8 = 10 // 签名校验错误 GinTimeError int8 = 11 // 客户端时间错误 GinVersionError int8 = 12 // 客户端版本过低 GinServerClosed int8 = 13 // 服务端暂停服务 GinParamError int8 = 14 // 参数校验失败 GinAuthError int8 = 15 // 身份鉴权失败 GinActionError int8 = 16 // 无接口操作权限 GinDataError int8 = 17 // 无数据操作权限 GinNotFound int8 = 18 // 未找到匹配接口 GinMustParam int8 = 19 // 缺少必要参数 GinApiStop int8 = 20 // 接口已停用 GinApiLock int8 = 21 // 请求业务处理中 GinSysError int8 = 22 // 系统处理异常 GinTransactionError int8 = 99 // 数据处理异常 )
Gin 错误定义
View Source
const ( AuditNone int8 = 0 // 未提交审核 AuditWait int8 = 1 // 已提交审核 AuditPass int8 = 2 // 已通过审核 AuditReject int8 = 3 // 已驳回审核 AuditCancel int8 = 9 // 已撤销审核 )
审核状态
View Source
const ( PlatformID uint64 = 1 // 平台ID GuestID uint64 = 0 // 访客ID )
内置用户ID
View Source
const ( UserTypeEmployee int8 = 1 // 平台用户,工作人员用户 UserTypeMember int8 = 2 // 注册用户,外部注册用户 )
用户类型
Variables ¶
View Source
var IDWorker = x.SnowfIDWorker(1, 1671033600000) // 2022-12-15 00:00:00.000
View Source
var Trans ut.Translator
Trans 翻译器
Functions ¶
This section is empty.
Types ¶
type GormJSON ¶
type GormJSON json.RawMessage
GormJSON defined JSON data type, need to implement driver.Valuer, sql.Scanner interface
func (*GormJSON) GormDBDataType ¶
GormDBDataType gorm dao data type
func (*GormJSON) GormDataType ¶
GormDataType gorm common data type
func (*GormJSON) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*GormJSON) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type Pager ¶
type Pager struct { Page int `json:"page" binding:"gte=1" label:"分页页码"` Size int `json:"size" binding:"gte=1,lte=10000" label:"加载数量"` Time int64 `json:"time" binding:"gte=0" label:"加载首页时间"` Pages int `json:"pages" label:"总页码"` Rows int `json:"rows" label:"总记录数"` }
Pager 分页信息
type Query ¶
type Query struct { SQL string // 业务SQL语句 Param []any // 业务SQL参数 Order string // Order 语句 Page int // 当前分页 Size int // 分页数量 Time int64 // 初次查询时间 Pages int // 总页码 Rows int // 总记录数 }
Query SQL查询对象
func (*Query) AddSQLParam ¶
AddSQLParam 添加语句和参数
type RedisError ¶
RedisError Redis 错误
func (*RedisError) Error ¶
func (e *RedisError) Error() string
Click to show internal directories.
Click to hide internal directories.