Documentation ¶
Index ¶
- Constants
- func ArrayWithTenantID(ctx context.Context, doc bson.A) bson.A
- func DbFromContext(ctx context.Context, origDbName string) string
- func DbNameForTenant(tenantId string, baseDb string) string
- func IsTenantDb(baseDb string) v1.TenantDbMatchFunc
- func TenantFromDbName(dbName string, baseDb string) string
- func WithTenantID(ctx context.Context, doc interface{}) bson.D
Constants ¶
View Source
const FieldTenantID = "tenant_id"
Variables ¶
This section is empty.
Functions ¶
func ArrayWithTenantID ¶
ArrayWithTenantID adds the tenant_id field to an array of bson documents using the value extracted from the identity of the context
func DbFromContext ¶
DbFromContext generates database name using tenant field from identity extracted from context and original database name
func DbNameForTenant ¶
DbNameForTenant composes tenant's db name.
func IsTenantDb ¶
func IsTenantDb(baseDb string) v1.TenantDbMatchFunc
IsTenantDb returns a function of `TenantDbMatchFunc` that can be used for checking if database has a tenant DB name format
func TenantFromDbName ¶
TenantFromDbName attempts to extract tenant ID from provided tenant DB name. Returns extracted tenant ID or an empty string.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.