Documentation ¶
Index ¶
- Constants
- func Exists(ctx context.Context, db *gorm.DB) (bool, error)
- func FindOne(ctx context.Context, db *gorm.DB, opts QueryOptions, out interface{}) (bool, error)
- func FindPage(ctx context.Context, db *gorm.DB, pp PaginationParam, opts QueryOptions, ...) (int64, error)
- func FromIsRootUser(ctx context.Context) bool
- func FromRowLock(ctx context.Context) bool
- func FromTraceID(ctx context.Context) string
- func FromTrans(ctx context.Context) (*gorm.DB, bool)
- func FromUserID(ctx context.Context) string
- func FromUserToken(ctx context.Context) string
- func GetBodyData(c *gin.Context) []byte
- func GetDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetToken(c *gin.Context) string
- func NewIsRootUser(ctx context.Context) context.Context
- func NewRowLock(ctx context.Context) context.Context
- func NewTraceID(ctx context.Context, traceID string) context.Context
- func NewTrans(ctx context.Context, db *gorm.DB) context.Context
- func NewUserCache(ctx context.Context, userCache UserCache) context.Context
- func NewUserID(ctx context.Context, userID string) context.Context
- func NewUserToken(ctx context.Context, userToken string) context.Context
- func NewXID() string
- func ParseForm(c *gin.Context, obj any) error
- func ParseJSON(c *gin.Context, obj any) error
- func ParseQuery(c *gin.Context, obj any) error
- func ResError(c *gin.Context, err error, status ...int)
- func ResJSON(c *gin.Context, status int, v any)
- func ResOK(c *gin.Context)
- func ResPage(c *gin.Context, v any, pr *PaginationResult)
- func ResSuccess(c *gin.Context, v any)
- type Direction
- type OrderByParam
- type OrderByParams
- type PaginationParam
- type PaginationResult
- type QueryOptions
- type ResponseResult
- type Trans
- type TransFunc
- type UserCache
Constants ¶
View Source
const ( ReqBodyKey = "req-body" ResBodyKey = "res-body" TreePathDelimiter = "." ASC Direction = "ASC" DESC Direction = "DESC" )
Variables ¶
This section is empty.
Functions ¶
func FindPage ¶
func FindPage(ctx context.Context, db *gorm.DB, pp PaginationParam, opts QueryOptions, out interface{}) (int64, error)
func FromIsRootUser ¶
func FromRowLock ¶
func FromTraceID ¶
func FromUserID ¶
func FromUserToken ¶
func ParseQuery ¶
ParseQuery Parse query parameter to struct
func ResSuccess ¶
Types ¶
type OrderByParam ¶
type OrderByParams ¶
type OrderByParams []OrderByParam
func (OrderByParams) ToSQL ¶
func (a OrderByParams) ToSQL() string
type PaginationParam ¶
type PaginationResult ¶
type PaginationResult struct { Total int64 `json:"total"` Current int `json:"current"` PageSize int `json:"pageSize"` }
func WrapPageQuery ¶
func WrapPageQuery(ctx context.Context, db *gorm.DB, pp PaginationParam, opts QueryOptions, out interface{}) (*PaginationResult, error)
type QueryOptions ¶
type QueryOptions struct { SelectFields []string OmitFields []string OrderFields OrderByParams }
type ResponseResult ¶
Click to show internal directories.
Click to hide internal directories.