Documentation ¶
Index ¶
- Constants
- func EnableDevelopment()
- func EnableProduction()
- func EnableStaging()
- func EnableTesting()
- func GenerateToken(username, password string, secret []byte) (string, error)
- func GetCommonFilterDB(db *gorm.DB, c *gin.Context) (dbRet *gorm.DB, err error)
- func GetEnvironment() string
- func HandleName(name string) string
- func IsDevelopment() bool
- func IsLocal() bool
- func IsProduction() bool
- func IsStaging() bool
- func IsTesting() bool
- func SignalHandler()
- func Unix2Time(t int64) string
- func UnixZero() int64
- type CustomClaims
- type Filter
- type Result
Constants ¶
View Source
const ( POKER = "POKER" LOCAL = "LOCAL" DEVELOPMENT = "DEVELOPMENT" TESTING = "TESTING" STAGING = "STAGING" PRODUCTION = "PRODUCTION" )
Variables ¶
This section is empty.
Functions ¶
func EnableDevelopment ¶
func EnableDevelopment()
func EnableProduction ¶
func EnableProduction()
func EnableStaging ¶
func EnableStaging()
func EnableTesting ¶
func EnableTesting()
func GetCommonFilterDB ¶
func GetEnvironment ¶
func GetEnvironment() string
func HandleName ¶
func IsDevelopment ¶
func IsDevelopment() bool
func IsProduction ¶
func IsProduction() bool
func SignalHandler ¶
func SignalHandler()
Types ¶
type CustomClaims ¶
type CustomClaims struct { Username string `json:"username"` Password string `json:"password"` jwt.StandardClaims }
func ParseToken ¶
func ParseToken(token string, secret []byte) (*CustomClaims, error)
type Filter ¶
type Filter struct { Field string `form:"field"` // 指定要从数据库检索的字段,默认情况下,将选择所有字段, 逗号隔开 "name, age" Order string `form:"order"` // 在从数据库检索记录时指定顺序, 逗号隔开 "age desc, name" Limit int `form:"limit" binding:"min=0"` // 指定要检索的记录数,单页记录数 Page int `form:"page" binding:"min=0"` // 指定在开始返回记录之前要跳过的记录数, 页码 Where string `form:"where"` // 过滤语句 ["age >= ? and role <> ?",20,"admin"] }
Click to show internal directories.
Click to hide internal directories.