DVTenants class
Resolves a tenant from a request, and holds the tenant the current work is running for.
DV.currentTenant is an alias for currentTenant.
Constructors
- DVTenants()
-
const
Properties
- currentTenant ↔ String
-
The tenant the current work is running for.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isolation → DVTenantIsolation
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → DVTenantSource
-
no setter
Methods
-
adopt(
Uri uri, {Map< String, String> headers = const {}}) → String -
Resolves the tenant for
uriand makes it current, returning what it resolved to. Falls back to defaultTenant when the request names none. -
configure(
{DVTenantIsolation? isolation, DVTenantSource? source, String? headerName, String? queryParameterName, Set< String> ? ignoredHostLabels, String? resolver(Uri uri, Map<String, String> headers)?}) → void -
Configures resolution.
resolveroverridessourceentirely, for hosts that map tenants some other way (a lookup table, a signed token). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
qualifierFor(
String tenant, {String base = 'dartvel'}) → String? -
The database or schema name for
tenantunder the configured isolation. -
resolve(
Uri uri, {Map< String, String> headers = const {}}) → String? -
The tenant
uriandheadersidentify, or null when they identify none. -
toString(
) → String -
A string representation of this object.
inherited
-
withTenant<
R> (String tenant, R callback()) → R -
Runs
callbackwithtenantcurrent for its entire execution.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
ignoredHostLabels
→ Set<
String> -
Host labels that are never a tenant.
www.example.comis the site, not a tenant called "www".no setter
Static Methods
-
reset(
) → void - Restores the defaults. Intended for tests.
Constants
- defaultTenant → const String
- The tenant used when nothing resolves one.