postgrelize / DefaultScope
Function: DefaultScope() ​
DefaultScope(
scope):ModelClassDecorator
Defined in: src/decorators/table-decorators.ts:36
Sets the default scope of a model (defaultScope of Model.init).
Parameters ​
scope ​
Readonly<Record<string, unknown>> | (() => ScopeOptions)
Scope options, or a function returning them (evaluated by addModels, so it may refer to other models).
Returns ​
A class decorator.
Example ​
ts
@DefaultScope(() => ({ where: { active: true } }))
class User extends Model {}