Documentation ¶
Index ¶
- Variables
- func RegistryTenantIDMiddleware() web.Option
- func TenantIDFromContext(ctx context.Context) (id int, err error)
- func TenantIDMiddleware(cfg *conf.Configuration) gin.HandlerFunc
- func UserIDFromContext(ctx context.Context) (int, error)
- func WithTenantID(parent context.Context, id int) context.Context
- type TenantOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TenantHeaderKey = "X-Tenant-ID" ErrMisTenantID = errors.New("miss tenant id") )
View Source
var (
ErrInvalidUserID = errors.New("invalid user")
)
Functions ¶
func RegistryTenantIDMiddleware ¶
RegistryTenantIDMiddleware register a middleware to get tenant id from request header
func TenantIDFromContext ¶
TenantIDFromContext returns the tenant id from context.tenant id is int format
func TenantIDMiddleware ¶
func TenantIDMiddleware(cfg *conf.Configuration) gin.HandlerFunc
TenantIDMiddleware returns middleware to get tenant id from http request
Types ¶
Click to show internal directories.
Click to hide internal directories.