Skip to main content
Version: 5.9

IQueryBuilder <T>

Index

Properties

optional_fields

_fields?: Field<T>[]

readonlyalias

alias: string

optionalreadonlytype

type?: QueryType

Methods

addSelect

  • addSelect(fields: string | string[]): IQueryBuilder<T>
  • Parameters

    • fields: string | string[]

    Returns IQueryBuilder<T>

andWhere

  • andWhere(cond: QBFilterQuery<T>): IQueryBuilder<T>
  • andWhere(cond: string, params?: any[]): IQueryBuilder<T>
  • Parameters

    • cond: QBFilterQuery<T>

    Returns IQueryBuilder<T>

count

  • count(field?: string | string[], distinct?: boolean): IQueryBuilder<T>
  • Parameters

    • optionalfield: string | string[]
    • optionaldistinct: boolean

    Returns IQueryBuilder<T>

delete

  • delete(cond?: QBFilterQuery): IQueryBuilder<T>
  • Parameters

    • optionalcond: QBFilterQuery

    Returns IQueryBuilder<T>

getAliasForJoinPath

  • getAliasForJoinPath(path: string): undefined | string
  • Parameters

    • path: string

    Returns undefined | string

getNextAlias

  • getNextAlias(entityName?: string): string
  • Parameters

    • optionalentityName: string

    Returns string

groupBy

  • groupBy(fields: string | keyof T | (string | keyof T)[]): IQueryBuilder<T>
  • Parameters

    • fields: string | keyof T | (string | keyof T)[]

    Returns IQueryBuilder<T>

having

  • having(cond?: string | QBFilterQuery, params?: any[]): IQueryBuilder<T>
  • Parameters

    • optionalcond: string | QBFilterQuery
    • optionalparams: any[]

    Returns IQueryBuilder<T>

innerJoinAndSelect

  • innerJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): IQueryBuilder<T>
  • Parameters

    • field: string
    • alias: string
    • optionalcond: QBFilterQuery
    • optionalfields: string[]

    Returns IQueryBuilder<T>

insert

  • insert(data: any): IQueryBuilder<T>
  • Parameters

    • data: any

    Returns IQueryBuilder<T>

join

  • join(field: string, alias: string, cond?: QBFilterQuery, type?: leftJoin | innerJoin | pivotJoin, path?: string): IQueryBuilder<T>
  • Parameters

    • field: string
    • alias: string
    • optionalcond: QBFilterQuery
    • optionaltype: leftJoin | innerJoin | pivotJoin
    • optionalpath: string

    Returns IQueryBuilder<T>

joinAndSelect

  • joinAndSelect(field: string, alias: string, cond?: QBFilterQuery): IQueryBuilder<T>
  • Parameters

    • field: string
    • alias: string
    • optionalcond: QBFilterQuery

    Returns IQueryBuilder<T>

leftJoin

  • leftJoin(field: string, alias: string, cond?: QBFilterQuery): IQueryBuilder<T>
  • Parameters

    • field: string
    • alias: string
    • optionalcond: QBFilterQuery

    Returns IQueryBuilder<T>

leftJoinAndSelect

  • leftJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): IQueryBuilder<T>
  • Parameters

    • field: string
    • alias: string
    • optionalcond: QBFilterQuery
    • optionalfields: string[]

    Returns IQueryBuilder<T>

orWhere

  • orWhere(cond: QBFilterQuery<T>): IQueryBuilder<T>
  • orWhere(cond: string, params?: any[]): IQueryBuilder<T>
  • Parameters

    • cond: QBFilterQuery<T>

    Returns IQueryBuilder<T>

orderBy

  • orderBy(orderBy: QueryOrderMap<T>): IQueryBuilder<T>
  • Parameters

    • orderBy: QueryOrderMap<T>

    Returns IQueryBuilder<T>

raw

  • raw(field: string): any
  • Parameters

    • field: string

    Returns any

select

  • select(fields: Field<T> | Field<T>[], distinct?: boolean): IQueryBuilder<T>
  • Parameters

    • fields: Field<T> | Field<T>[]
    • optionaldistinct: boolean

    Returns IQueryBuilder<T>

truncate

  • truncate(): IQueryBuilder<T>
  • Returns IQueryBuilder<T>

update

  • update(data: any): IQueryBuilder<T>
  • Parameters

    • data: any

    Returns IQueryBuilder<T>

where

  • where(cond: QBFilterQuery<T>, operator?: $and | $or): IQueryBuilder<T>
  • where(cond: string, params?: any[], operator?: $and | $or): IQueryBuilder<T>
  • Parameters

    • cond: QBFilterQuery<T>
    • optionaloperator: $and | $or

    Returns IQueryBuilder<T>

withSubQuery

  • withSubQuery(subQuery: QueryBuilder<any, any>, alias: string): IQueryBuilder<T>
  • Parameters

    • subQuery: QueryBuilder<any, any>
    • alias: string

    Returns IQueryBuilder<T>