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) WithRoutesQs(routes []*Route, routeQS *RouteQS)
- func (s *BootContext) WithTask(tasks map[string][]gin.HandlerFunc)
- type BootPlugin
- type LogHandler
- type LogOpType
- type Route
- func (s *Route) WithAuth(value bool) *Route
- func (s *Route) WithLabel(value string) *Route
- func (s *Route) WithMethod(value string) *Route
- func (s *Route) WithName(value string) *Route
- func (s *Route) WithNoAppCode(value bool) *Route
- func (s *Route) WithPath(value string) *Route
- func (s *Route) WithTokenKey(value string) *Route
- type RouteHandler
- type RouteQS
- func (s *RouteQS) WithAuth(value bool) *RouteQS
- func (s *RouteQS) WithLabel(value string) *RouteQS
- func (s *RouteQS) WithMethod(value string) *RouteQS
- func (s *RouteQS) WithName(value string) *RouteQS
- func (s *RouteQS) WithNoAppCode(value bool) *RouteQS
- func (s *RouteQS) WithTokenKey(value string) *RouteQS
- 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) WithRoutesQs ¶ added in v1.0.26
func (s *BootContext) WithRoutesQs(routes []*Route, routeQS *RouteQS)
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 Label string Path string Method string EnsureAuth bool NoAppCode bool Handle RouteHandler TokenKey string }
路由定义
func (*Route) WithMethod ¶ added in v1.0.27
func (*Route) WithNoAppCode ¶ added in v1.0.27
func (*Route) WithTokenKey ¶ added in v1.0.27
type RouteHandler ¶ added in v1.0.27
func (RouteHandler) Route ¶ added in v1.0.27
func (s RouteHandler) Route() *Route
type RouteQS ¶ added in v1.0.26
type RouteQS struct { Name *string Label *string Method *string EnsureAuth *bool NoAppCode *bool TokenKey *string // contains filtered or unexported fields }
func NewRouteQS ¶ added in v1.0.26
func NewRouteQS() *RouteQS
func (*RouteQS) WithMethod ¶ added in v1.0.26
func (*RouteQS) WithNoAppCode ¶ added in v1.0.27
func (*RouteQS) WithTokenKey ¶ added in v1.0.26
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.