Options
All
  • Public
  • Public/Protected
  • All
Menu

Manages a collection of models (rows in a db table) It follows Repository pattern

Hierarchy

Index

Constructors

constructor

Properties

Protected model

model: any

Methods

Private createColumnRelation

  • createColumnRelation(index: number): void

Private createColumns

  • createColumns(columns: Column[], tableBuilder: TableBuilder): void

createModelInstances

  • createModelInstances(pojos: Object[]): Model[]
  • Given an array of pojos it returns an array of model instances

    Parameters

    • pojos: Object[]

      (Plain Old Javascript Object)

    Returns Model[]

Private createRelations

  • createRelations(): void

Private createTable

  • createTable(tableName: string, columns: Column[]): void

getAll

  • getAll(load?: object): Model[]
  • Parameters

    • Default value load: object = {children: false}
      • children: boolean

    Returns Model[]

getByFilter

  • getByFilter(filter: Object, columns?: string[], load?: object): Model[]
  • Parameters

    • filter: Object
    • Default value columns: string[] = []
    • Default value load: object = {children: false}
      • children: boolean

    Returns Model[]

getById

  • getById(id: string | number, load?: object): Model
  • Parameters

    • id: string | number
    • Default value load: object = {children: false}
      • children: boolean

    Returns Model

getByOperator

  • getByOperator(termA: any, operator: string, termB: any, columns?: string[], load?: object): Model[]
  • Parameters

    • termA: any
    • operator: string
    • termB: any
    • Default value columns: string[] = []
    • Default value load: object = {children: false}
      • children: boolean

    Returns Model[]

Private hasRelations

  • hasRelations(): boolean

Protected insert

  • insert(model?: any): number | string

query

  • query(): any

remove

  • remove(model?: any): number

save

  • save(model?: any): number | string

tableName

  • tableName(): string

Protected update

  • update(model?: any): number | string

Static deleteTable

  • deleteTable(tableName: string): void
  • For posible future use Deletes the table corresponding to the collection

    Parameters

    • tableName: string

    Returns void

Static getTableSchema

  • getTableSchema(modelClass: any): Object[]
  • Get table structure and metadata for a model

    Parameters

    • modelClass: any

    Returns Object[]

    Column metadata

Static hasColumn

  • hasColumn(tableName: string, columnName: string): boolean
  • Returns table schema with column metadata

    Parameters

    • tableName: string
    • columnName: string

    Returns boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc