runWithTenant
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
runWithTenant<
T>(tenantId,fn):T
Defined in: tenant-scope.ts:26
Runs fn with tenantId as the current tenant for everything it calls,
synchronously or asynchronously.
Use it where work enters the application, such as HTTP middleware or a queue
job, or to change the tenant for part of a handler. A pipeline dispatched
inside fn takes this tenant, and nested dispatches inherit it. A nested
call replaces the tenant for its own callback only, and undefined runs fn
with no tenant.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”tenantId
Section titled “tenantId”string | undefined
The tenant for the callback, or undefined for none.
() => T
The work to run.
Returns
Section titled “Returns”T
What fn returns (its promise, for an async callback).
Example
Section titled “Example”await runWithTenant(job.data.tenant, () => processBatch(job.data));