Documentation
¶
Index ¶
Constants ¶
View Source
const CasbinModelConf = `` /* 166-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func MustCasbinEnforcer ¶
func MustCasbinEnforcer(svcCtx *ServiceContext) *casbin.Enforcer
func WithServerless ¶
func WithServerless(serverless bool) opts.Opt[ServiceContextOpts]
Types ¶
type Middleware ¶
type Middleware struct {
Authx rest.Middleware
Ok func(ctx context.Context, data any) any
Error func(ctx context.Context, err error) (int, any)
I18n rest.Middleware
Validate *middleware.ValidatorMiddleware
}
func NewMiddleware ¶
func NewMiddleware(svcCtx *ServiceContext, route2code func(r *http.Request) string) Middleware
type ServiceContext ¶
type ServiceContext struct {
Config config.Config
SqlxConn sqlx.SqlConn
Redis *redis.Redis
Cache cache.Cache
CasbinEnforcer *casbin.Enforcer
Trans *i18n.Translator
Middleware
}
func NewServiceContext ¶
func NewServiceContext(c config.Config, route2code func(r *http.Request) string, op ...opts.Opt[ServiceContextOpts]) *ServiceContext
type ServiceContextOpts ¶
type ServiceContextOpts struct {
Serverless bool
}
func (ServiceContextOpts) DefaultOptions ¶
func (opts ServiceContextOpts) DefaultOptions() ServiceContextOpts
Click to show internal directories.
Click to hide internal directories.