Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HasMany<T, T2>

One-to-many relation implementation.

Type parameters

Hierarchy

Index

Constructors

constructor

  • new HasMany<T, T2>(parent: T, related: T2, foreignKeyOverride?: keyof T & string, localKeyOverride?: keyof T2 & string): HasMany<T, T2>

Properties

Protected cachedLoaded

cachedLoaded: boolean = false

Protected Optional cachedValue

cachedValue: Collection<T2>

Protected Optional foreignKeyOverride

foreignKeyOverride: keyof T & string

Protected Optional localKeyOverride

localKeyOverride: keyof T2 & string

Protected parent

parent: T

Readonly related

related: T2

Accessors

foreignKey

  • get foreignKey(): string

localKey

  • get localKey(): string

parentValue

  • get parentValue(): any

qualifiedForeignKey

  • get qualifiedForeignKey(): string

qualifiedLocalKey

  • get qualifiedLocalKey(): string

relatedQuerySource

value

  • get value(): V

Methods

applyScope

buildEagerQuery

builder

fetch

get

getContainer

getValue

isLoaded

  • isLoaded(): boolean

make

  • make<T>(target: any, ...parameters: any[]): T

matchResults

query

setContainer

setValue

then

  • then(resolve: (result: Collection<T2>) => unknown, reject: (e: Error) => unknown): void
  • Makes the relation "thenable" so relation methods on models can be awaited to yield the result of the relation.

    example
    const rows = await myModelInstance.myHasManyRelation()  -- rows is a Collection
    

    Parameters

    • resolve: (result: Collection<T2>) => unknown
    • reject: (e: Error) => unknown
        • (e: Error): unknown
        • Parameters

          • e: Error

          Returns unknown

    Returns void

Extollo Logo

extollo (v. latin) - to lift up, to elevate

Extollo is a free & libre application framework in TypeScript.