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 RouteBuilder
- func (s *RouteBuilder) AddRoute(path string, handler RouteHandler) *RouteBuilder
- func (s *RouteBuilder) Result() ([]*Route, *RouteQS)
- func (s *RouteBuilder) WithAuth(value bool) *RouteBuilder
- func (s *RouteBuilder) WithLabel(value string) *RouteBuilder
- func (s *RouteBuilder) WithMethod(value string) *RouteBuilder
- func (s *RouteBuilder) WithName(value string) *RouteBuilder
- func (s *RouteBuilder) WithNoAppCode(value bool) *RouteBuilder
- func (s *RouteBuilder) WithTokenKey(value string) *RouteBuilder
- type RouteHandler
- type 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 AppModelHandle 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 RouteBuilder ¶ added in v1.0.29
type RouteBuilder struct { RouteQS // contains filtered or unexported fields }
func NewRouteBuidler ¶ added in v1.0.29
func NewRouteBuidler() *RouteBuilder
func (*RouteBuilder) AddRoute ¶ added in v1.0.29
func (s *RouteBuilder) AddRoute(path string, handler RouteHandler) *RouteBuilder
func (*RouteBuilder) Result ¶ added in v1.0.29
func (s *RouteBuilder) Result() ([]*Route, *RouteQS)
func (*RouteBuilder) WithAuth ¶ added in v1.0.30
func (s *RouteBuilder) WithAuth(value bool) *RouteBuilder
func (*RouteBuilder) WithLabel ¶ added in v1.0.30
func (s *RouteBuilder) WithLabel(value string) *RouteBuilder
func (*RouteBuilder) WithMethod ¶ added in v1.0.30
func (s *RouteBuilder) WithMethod(value string) *RouteBuilder
func (*RouteBuilder) WithName ¶ added in v1.0.30
func (s *RouteBuilder) WithName(value string) *RouteBuilder
func (*RouteBuilder) WithNoAppCode ¶ added in v1.0.30
func (s *RouteBuilder) WithNoAppCode(value bool) *RouteBuilder
func (*RouteBuilder) WithTokenKey ¶ added in v1.0.30
func (s *RouteBuilder) WithTokenKey(value string) *RouteBuilder
type RouteHandler ¶ added in v1.0.27
func (RouteHandler) Route ¶ added in v1.0.27
func (s RouteHandler) Route() *Route
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.