Documentation
¶
Index ¶
- Constants
- Variables
- func TenantIDFromContext(ctx context.Context) (id int, err error)
- func TenantIDLoadFromContext(ctx context.Context) (id int, ok bool)
- func UserIDFromContext(ctx context.Context) (int, error)
- func UserIDFromContextAsInt(ctx context.Context) (int, error)
- func WithTenantID(parent context.Context, id int) context.Context
Constants ¶
View Source
const ( TenantContextKey = "_woocoos/knockout/tenant_id" TenantHeaderKey = "X-Tenant-ID" )
Variables ¶
View Source
var ( ErrInvalidUserID = errors.New("invalid user") ErrMisTenantID = errors.New("miss tenant id") )
Functions ¶
func TenantIDFromContext ¶
TenantIDFromContext returns the tenant id from context.
func TenantIDLoadFromContext ¶
TenantIDLoadFromContext returns the tenant id from context. tenant id has set by int format, this function simply returns the value.
func UserIDFromContext ¶
UserIDFromContext returns the user id from context.
func UserIDFromContextAsInt ¶
UserIDFromContextAsInt returns the user id from context, the context don't save Int UserID in context, we need transfer it from string to int
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.