store

package
v0.0.0-...-d078b10 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const FieldTenantID = "tenant_id"

Variables

This section is empty.

Functions

func ArrayWithTenantID

func ArrayWithTenantID(ctx context.Context, doc bson.A) bson.A

ArrayWithTenantID adds the tenant_id field to an array of bson documents using the value extracted from the identity of the context

func DbFromContext

func DbFromContext(ctx context.Context, origDbName string) string

DbFromContext generates database name using tenant field from identity extracted from context and original database name

func DbNameForTenant

func DbNameForTenant(tenantId string, baseDb string) string

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

func TenantFromDbName(dbName string, baseDb string) string

TenantFromDbName attempts to extract tenant ID from provided tenant DB name. Returns extracted tenant ID or an empty string.

func WithTenantID

func WithTenantID(ctx context.Context, doc interface{}) bson.D

WithTenantID adds the tenant_id field to a bson document using the value extracted from the identity of the context

Types

This section is empty.

Jump to

Keyboard shortcuts

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