Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RelationBuilder<T>

ModelBuilder instance that queries the related model in a relation.

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

Protected Readonly ModelClass

ModelClass: Function & { prototype: T } & new (...args: any[]) => T & typeof Model & Instantiable<T>

Protected appliedScopes

appliedScopes: Collection<{ accessor: string | Instantiable<Scope>; scope: ScopeClosure }> = ...

Protected constraints

constraints: Constraint[] = []

Constraints applied to this query.

Protected Readonly databaseService

databaseService: DatabaseService

Protected eagerLoadRelations

eagerLoadRelations: keyof T[] = []

Protected Optional rawSql

rawSql: string

Raw SQL to use instead. Overrides builder methods.

Protected Optional registeredConnection

registeredConnection: Connection

The connection on which the query should be executed.

Protected registeredDistinct

registeredDistinct: boolean = false

If true, the query should refer to distinct records.

Protected registeredFields

registeredFields: SpecifiedField[] = []

The fields to query from the table.

Protected registeredGroupings

registeredGroupings: string[] = []

Array of SQL group-by clauses.

Protected registeredOrders

registeredOrders: OrderStatement[] = []

Array of SQL order-by clauses.

Protected Optional registeredSkip

registeredSkip: number

The number of records to skip before the result set.

Protected Optional registeredTake

registeredTake: number

The max number of records to include in the result set.

Protected relation

relation: Relation<any, T, any>

Protected Optional source

source: QuerySource

The source table to query from.

Accessors

Private appClassApplication

appliedConstraints

appliedDistinction

  • get appliedDistinction(): boolean

appliedFields

appliedGroupings

  • get appliedGroupings(): string[]

appliedOrder

appliedPagination

  • get appliedPagination(): { skip: undefined | number; take: undefined | number }
  • Get the skip/take values of this query.

    Returns { skip: undefined | number; take: undefined | number }

    • skip: undefined | number
    • take: undefined | number

appliedRawSql

  • get appliedRawSql(): Maybe<string>

querySource

Methods

Protected app

clearFields

clone

connection

Protected container

delete

distinct

exists

  • exists(): Promise<boolean>

field

fields

finalize

first

  • first(): Promise<undefined | T>

from

get

getBoundMethod

  • getBoundMethod(methodName: string): (...args: any[]) => any
  • Get the method with the given name from this class, bound to this class.

    Parameters

    • methodName: string

    Returns (...args: any[]) => any

    function

      • (...args: any[]): any
      • Parameters

        • Rest ...args: any[]

        Returns any

getEagerLoadedRelations

  • getEagerLoadedRelations(): keyof T[]

getNewInstance

getResultIterable

groupBy

insert

  • Insert the given rows into the table for this query, returning the fields specified in this query.

    example
    const rows = [
     { name: 'A' },
     { name: 'B' },
    ]
    
    query.table('my_table')
     .returning('id', 'name')
     .insert(rows)
    

    This is equivalent to:

    INSERT INTO my_table (name)
    VALUES ('A'), ('B')
    RETURNING id, name
    

    Parameters

    • rowOrRows: {} | {}[]

    Returns Promise<QueryResult>

iterator

limit

Protected make

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

Protected normalizeModelKeys

notDistinct

offset

orWhere

orWhereIn

orWhereNot

orWhereNotIn

orWhereRaw

orderBy

orderByAscending

orderByDescending

page

raw

returning

select

skip

table

take

update

where

whereIn

whereKey

whereNot

whereNotIn

whereProperty

whereRaw

with

withScopes

withoutGlobalScope

withoutGlobalScopes

Extollo Logo

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

Extollo is a free & libre application framework in TypeScript.