Types

DB Payload

declare type DBPayload = { 
  filter?: {
    attributes?: DBAttribute,
    where?: DBWhere,
    limit?: Number,
    offset?: Number,
    order?: DBOrderBy,
    group?: DBGrouopBy,
  }, 
  context?: Object 
}

DB Attribute

declare type DBAttribute = DBColumn | DBFunction | DBValue | DBSubQuery | string

DB Function

declare type DBFunction = { 
    func: string, 
    args: any[], 
    alias?: string 
}

DB Column

declare type DBColumn = { 
  column: string | DBFunction, 
  alias?: string 
} | string

DB Value

declare type DBValue = { 
  value: string | number, 
  alias?: string 
}

DB SubQuery

declare type DBSubQuery = { 
  select: DBPayload 
}

DB Operator

declare type DBOperator = string

DB Where Clause

declare type DBWhere = { 
  operator: string, 
  args: Array<DBWhere | DBWhereArgs> 
}

DB Where Arguments

declare type DBWhereArgs = Array<DBWhereAttribute, DBWhereLogic>

DB Where Attribute

declare type DBWhereAttribute = DBColumn | DBFunction

DB Where logic

declare type DBWhereLogic = DBColumn | DBFunction | Number | string

DB Order By Clause

declare type DBOrderBy = DBColumn | Number | { 
  column: DBColumn | Number, 
  direction?: DBOrderDirection 
}

DB Order Direction

declare type DBOrderDirection = 'ASC' | 'DESC'

DB Group By Clause

declare type DBGroupBy = DBColumn | DBFunction | string

DB Logic

declare type DBLogic = DBFunction | DBWhere | DBSubQuery | boolean

Go to the next chapter to know more about Attributes.




results matching ""

    No results matching ""