svc

package
v0.0.0-...-7e392fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL