Documentation
¶
Overview ¶
some struct for swagger used
Index ¶
- Constants
- func BadRequest(c *gin.Context, err error)
- func Created(c *gin.Context, data interface{})
- func Error(c *gin.Context, code int, err error)
- func Forbidden(c *gin.Context, err error)
- func NewPageDataFromContext[T any](c *gin.Context, list []T, namefunc func(item T) string, ...) response.Page[T]
- func NoContent(c *gin.Context, data interface{})
- func NotOK(c *gin.Context, err error)
- func OK(c *gin.Context, data interface{})
- func Page[T any](total int64, list []T, page, size int64) *response.Page[T]
- func Response(c *gin.Context, code int, data interface{}, err error)
- func Unauthorized(c *gin.Context, err error)
- type ClusterIsolatedSwitch
- type IsolatedSwitch
- type PageData
- type PageQueryCond
- type QArgs
- type ResponseStruct
- type URLQuery
- func (q *URLQuery) Count(db *gorm.DB, cond *PageQueryCond) (total int64, err error)
- func (q *URLQuery) MustPreload(mustpreloads []string) *URLQuery
- func (q *URLQuery) PageList(db *gorm.DB, cond *PageQueryCond, dest interface{}) (total int64, page, size int64, err error)
- func (q *URLQuery) PageQuery(db *gorm.DB, cond *PageQueryCond) *gorm.DB
Constants ¶
View Source
const (
MessageOK = "ok"
MessageNotFound = "not found"
MessageForbidden = "forbidden"
MessageUnauthorized = "unauthorized"
)
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶ added in v1.23.8
func BadRequest(c *gin.Context, err error)
func NewPageDataFromContext ¶
func NewPageDataFromContext[T any](c *gin.Context, list []T, namefunc func(item T) string, timefunc func(item T) time.Time) response.Page[T]
func Unauthorized ¶
func Unauthorized(c *gin.Context, err error)
Types ¶
type ClusterIsolatedSwitch ¶
type ClusterIsolatedSwitch struct {
Isolate bool `json:"isolate"`
ClusterID uint `json:"cluster_id" binding:"required"`
}
网络隔离用到的数据结构
type IsolatedSwitch ¶
type IsolatedSwitch struct {
Isolate bool `json:"isolate"`
}
type PageData ¶
type PageData struct {
Total int64
List interface{}
CurrentPage int64
CurrentSize int64
}
type PageQueryCond ¶
type PageQueryCond struct {
Model string
SearchFields []string
SortFields []string
PreloadFields []string
PreloadSensitiveFields map[string]string
Select *QArgs
Join *QArgs
Where []*QArgs
}
type ResponseStruct ¶
type ResponseStruct struct {
Message string
Data interface{}
ErrorData interface{}
}
type URLQuery ¶
type URLQuery struct {
Page string `form:"page"`
Size string `form:"size"`
Order string `form:"order"`
Search string `form:"search"`
Preload string `form:"preload"`
// contains filtered or unexported fields
}
func GetQuery ¶
func GetQuery(c *gin.Context, sortFunc func(interface{}, string)) (*URLQuery, error)
func NewURLQuery ¶
func NewURLQuery(sortfn func(interface{}, string)) *URLQuery
func (*URLQuery) Count ¶
func (q *URLQuery) Count(db *gorm.DB, cond *PageQueryCond) (total int64, err error)
func (*URLQuery) MustPreload ¶
func (q *URLQuery) MustPreload(mustpreloads []string) *URLQuery
Click to show internal directories.
Click to hide internal directories.