Documentation ¶
Index ¶
- Variables
- func GetAppConfig[T int | uint | int64 | uint64 | bool | string | []any | map[string]any](s *AppModel, key string, defaultValue T) T
- func GetEnvConfig[T int | uint | int64 | uint64 | bool | string | []any | map[string]any](s *AppModel, env *utils.EnvGetter) T
- func SetBootContext(bootContext *BootContext)
- type AppModel
- type AppModelHandler
- type BootContext
- func (s *BootContext) Get(key string) any
- func (s *BootContext) GetTokenHandler(key string) TokenHandler
- func (s *BootContext) Install(r *gin.Engine, plugins ...BootPlugin)
- func (s *BootContext) Load(key string) (any, bool)
- func (s *BootContext) PrintAddr()
- func (s *BootContext) Set(key string, value any)
- func (s *BootContext) SetTokenHandler(key string, handler TokenHandler)
- func (s *BootContext) WithRoutes(routes ...[]*Route)
- func (s *BootContext) WithTask(tasks map[string][]gin.HandlerFunc)
- type BootPlugin
- type LogHandler
- type LogOpType
- type Route
- type TokenHandler
- type UserInfo
- type UserToken
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *logrus.Logger = logrus.New()
Functions ¶
func GetAppConfig ¶
func GetEnvConfig ¶
func SetBootContext ¶
func SetBootContext(bootContext *BootContext)
Types ¶
type AppModel ¶
type BootContext ¶
type BootContext struct { Xorm *xorm.Engine Redis *redis.Client SessionHandle gin.HandlerFunc Logger *logrus.Logger TokenHandlers map[string]TokenHandler AppModdelHandle AppModelHandler LogHandle LogHandler Routes []*Route Tasks map[string][]gin.HandlerFunc Addr string // contains filtered or unexported fields }
func GetBootContext ¶
func GetBootContext() *BootContext
func NewBootContext ¶ added in v1.0.9
func NewBootContext() *BootContext
func (*BootContext) Get ¶ added in v1.0.9
func (s *BootContext) Get(key string) any
func (*BootContext) GetTokenHandler ¶ added in v1.0.19
func (s *BootContext) GetTokenHandler(key string) TokenHandler
func (*BootContext) Install ¶
func (s *BootContext) Install(r *gin.Engine, plugins ...BootPlugin)
func (*BootContext) PrintAddr ¶
func (s *BootContext) PrintAddr()
func (*BootContext) Set ¶ added in v1.0.9
func (s *BootContext) Set(key string, value any)
func (*BootContext) SetTokenHandler ¶ added in v1.0.19
func (s *BootContext) SetTokenHandler(key string, handler TokenHandler)
func (*BootContext) WithRoutes ¶
func (s *BootContext) WithRoutes(routes ...[]*Route)
func (*BootContext) WithTask ¶
func (s *BootContext) WithTask(tasks map[string][]gin.HandlerFunc)
type BootPlugin ¶
type BootPlugin func(ctx *BootContext, r *gin.Engine)
type LogHandler ¶
type Route ¶
type Route struct { Name string Path string Method string EnsureAuth bool NoAppCode bool Handle gin.HandlerFunc TokenKey string }
路由定义
type UserToken ¶
type UserToken struct { UserInfo UserInfo `json:"userInfo"` AccessToken string `json:"accessToken"` RefreshToken string `json:"refreshToken"` CreatedAt time.Time `json:"createdAt"` AccessExpiredAt time.Time `json:"accessExpiredAt"` RefreshExpiredAt time.Time `json:"refreshExpiredAt"` TokenKey string `json:"tokenKey"` }
func (UserToken) IsTokenExpired ¶
Click to show internal directories.
Click to hide internal directories.