Skip to main content
Version: 5.7

Reference <T>

Hierarchy

Index

Constructors

constructor

  • Type parameters

    • T

    Parameters

    • entity: T

    Returns Reference<T>

Methods

[custom]

  • [custom](depth: number): string
  • Parameters

    • depth: number

    Returns string

getEntity

  • getEntity(): T
  • Returns T

getProperty

  • getProperty<K>(prop: K): T[K]
  • Type parameters

    • K: string | number | symbol

    Parameters

    • prop: K

    Returns T[K]

isInitialized

  • isInitialized(): boolean
  • Returns boolean

load

  • Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns the entity.


    Type parameters

    • K: string | number | symbol = never
    • P: string = never

    Parameters

    Returns Promise<T>

populated

  • populated(populated?: boolean): void
  • Parameters

    • optionalpopulated: boolean

    Returns void

set

toJSON

unwrap

  • unwrap(): T
  • Returns T

staticcreate

staticcreateFromPK

staticcreateNakedFromPK

  • createNakedFromPK<T, PK>(entityType: EntityClass<T>, pk: Primary<T>, options?: { schema?: string }): T

staticisReference

  • isReference<T>(data: any): data is Reference<T>
  • Checks whether the argument is instance of Reference wrapper.


    Type parameters

    • T: object

    Parameters

    • data: any

    Returns data is Reference<T>

staticunwrapReference

  • Returns wrapped entity.


    Type parameters

    • T: object

    Parameters

    Returns T

staticwrapReference

  • Wraps the entity in a Reference wrapper if the property is defined as wrappedReference.


    Type parameters

    • T: object

    Parameters

    Returns T | Reference<T>