Skip to main content
Version: 5.9

Reference <T>

Hierarchy

Index

Constructors

constructor

  • Type parameters

    • T

    Parameters

    • entity: T

    Returns Reference<T>

Methods

[custom]

  • [custom](depth): string
  • Parameters

    • depth: number

    Returns string

getEntity

  • getEntity(): T
  • Returns T

getProperty

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

    • K: string | number | symbol

    Parameters

    • prop: K

    Returns T[K]

isInitialized

  • isInitialized(): boolean
  • Returns boolean

load

  • load<K, P>(options): Promise<T>
  • load<K>(prop): Promise<T[K]>
  • 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): void
  • Parameters

    • optionalpopulated: boolean

    Returns void

set

  • set(entity): void

toJSON

unwrap

  • unwrap(): T
  • Returns T

staticcreate

staticcreateFromPK

staticcreateNakedFromPK

  • createNakedFromPK<T, PK>(entityType, pk, options): T
  • Type parameters

    Parameters

    • entityType: EntityClass<T>
    • pk: Primary<T>
    • optionaloptions: { schema?: string }
      • optionalschema: string

    Returns T

staticisReference

  • Checks whether the argument is instance of Reference wrapper.


    Type parameters

    • T: object

    Parameters

    • data: any

    Returns data is Reference<T>

staticunwrapReference

  • unwrapReference<T>(ref): T
  • Returns wrapped entity.


    Type parameters

    • T: object

    Parameters

    Returns T

staticwrapReference

  • wrapReference<T>(entity, prop): T | Reference<T>
  • Wraps the entity in a Reference wrapper if the property is defined as wrappedReference.


    Type parameters

    • T: object

    Parameters

    Returns T | Reference<T>