ScalarReference <Value>
Index
Constructors
Methods
Constructors
constructor
Parameters
optionalvalue: Value
initialized: boolean = ...
Returns ScalarReference<Value>
Methods
bind
Binds this scalar reference to a specific entity and property for lazy loading support.
Parameters
entity: Entity
property: EntityKey<Entity>
Returns void
isInitialized
Returns whether the scalar value has been loaded.
Returns boolean
load
Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns either the whole entity, or the requested property.
Parameters
optionaloptions: Omit<LoadReferenceOptions<any, any, never, never>, fields | exclude | populate>
Returns Promise<undefined | Value>
loadOrFail
Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns the entity or throws an error just like
em.findOneOrFail()(and respects the same config options).Parameters
options: Omit<LoadReferenceOrFailOptions<any, any, never, never>, fields | exclude | populate> = {}
Returns Promise<Value>
set
Sets the scalar value and marks the reference as initialized.
Parameters
value: Value
Returns void
unwrap
Returns the current scalar value, or undefined if not yet loaded.
Returns undefined | Value
staticisScalarReference
Parameters
data: any
Returns data is ScalarReference<any>
Wrapper for lazy scalar properties that provides on-demand loading from the database.