Documentation
¶
Index ¶
- func Cors(cfg *utils.Config) gin.HandlerFunc
- func GetSub(ctx context.Context, cfg *wcmd_utils.Config) string
- func GetTid(ctx context.Context, cfg *wcmd_utils.Config) string
- func GetTxFromContext(ctx context.Context) (*gorm.DB, error)
- func InstanceMetric(port string, host string, engine *gin.Engine) *gin.Engine
- func MapPtrSlice[T any, U any](items []*T, mapper func(*T) *U) []*U
- func SaveRequestContext(ctx context.Context, reqCtx *RequestContext, cfg *wcmd_utils.Config) context.Context
- func ShutdownServer(ctx context.Context, engine http.Handler, host string, port string)
- type Helper
- type PaginationRequest
- func (p *PaginationRequest) GetLimit() int
- func (p *PaginationRequest) GetNextPage(total int64) int
- func (p *PaginationRequest) GetOffset() int
- func (p *PaginationRequest) GetOrder(defaultOrder string) string
- func (p *PaginationRequest) GetPage() int
- func (p *PaginationRequest) GetPrevPage() int
- func (p *PaginationRequest) GetSort(defaultSort string) string
- func (p *PaginationRequest) GormScope() func(db *gorm.DB) *gorm.DB
- func (p *PaginationRequest) HasNext(total int64) bool
- func (p *PaginationRequest) HasPrev() bool
- func (p *PaginationRequest) Normalize()
- func (p *PaginationRequest) ToPaginationResponse(total int64) PaginationResponse
- func (p *PaginationRequest) TotalPages(total int64) int
- type PaginationResponse
- type RequestContext
- type TransactionError
- type TxManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTxFromContext ¶ added in v1.0.1
func InstanceMetric ¶ added in v1.1.1
func MapPtrSlice ¶ added in v1.1.0
[]*T -> []*U
func SaveRequestContext ¶
func SaveRequestContext(ctx context.Context, reqCtx *RequestContext, cfg *wcmd_utils.Config) context.Context
Types ¶
type PaginationRequest ¶ added in v1.0.5
type PaginationRequest struct {
Page int `form:"page" binding:"omitempty,min=1"`
Limit int `form:"limit" binding:"omitempty,min=1,max=100"`
Search string `form:"search"`
Sort string `form:"sort"`
Order string `form:"order"`
}
func (*PaginationRequest) GetLimit ¶ added in v1.0.5
func (p *PaginationRequest) GetLimit() int
func (*PaginationRequest) GetNextPage ¶ added in v1.0.5
func (p *PaginationRequest) GetNextPage(total int64) int
func (*PaginationRequest) GetOffset ¶ added in v1.0.5
func (p *PaginationRequest) GetOffset() int
func (*PaginationRequest) GetOrder ¶ added in v1.0.5
func (p *PaginationRequest) GetOrder(defaultOrder string) string
func (*PaginationRequest) GetPage ¶ added in v1.0.5
func (p *PaginationRequest) GetPage() int
func (*PaginationRequest) GetPrevPage ¶ added in v1.0.5
func (p *PaginationRequest) GetPrevPage() int
func (*PaginationRequest) GetSort ¶ added in v1.0.5
func (p *PaginationRequest) GetSort(defaultSort string) string
func (*PaginationRequest) GormScope ¶ added in v1.0.5
func (p *PaginationRequest) GormScope() func(db *gorm.DB) *gorm.DB
func (*PaginationRequest) HasNext ¶ added in v1.0.5
func (p *PaginationRequest) HasNext(total int64) bool
func (*PaginationRequest) HasPrev ¶ added in v1.0.5
func (p *PaginationRequest) HasPrev() bool
func (*PaginationRequest) Normalize ¶ added in v1.0.5
func (p *PaginationRequest) Normalize()
func (*PaginationRequest) ToPaginationResponse ¶ added in v1.0.5
func (p *PaginationRequest) ToPaginationResponse(total int64) PaginationResponse
func (*PaginationRequest) TotalPages ¶ added in v1.0.5
func (p *PaginationRequest) TotalPages(total int64) int
type PaginationResponse ¶ added in v1.0.5
type RequestContext ¶ added in v1.0.5
func GetRequestContext ¶
func GetRequestContext(ctx context.Context, cfg *wcmd_utils.Config) *RequestContext
func NewRequestContext ¶ added in v1.0.5
func NewRequestContext(sub, tid string) *RequestContext
func NewRequestContextFull ¶ added in v1.0.5
func NewRequestContextFull(sub, tid string) *RequestContext
type TransactionError ¶ added in v1.0.1
func (*TransactionError) Error ¶ added in v1.0.1
func (e *TransactionError) Error() string
type TxManager ¶ added in v1.0.1
type TxManager struct {
// contains filtered or unexported fields
}
func NewTxManager ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.