Class OINODataModel

OINO Datamodel object for representing one database table and it's columns.

Constructors

  • Constructor of the data model. NOTE! OINODataModel.initialize must be called after constructor to populate fields.

    Parameters

    Returns OINODataModel

Properties

api: OINOApi

Database refererence of the table

fields: OINODataField[]

Field refererences of the API

Methods

  • Add a field to the datamodel.

    Parameters

    Returns void

  • Find all fields based of given filter callback criteria (e.g. fields of certain data type, primary keys etc.)

    Parameters

    Returns OINODataField[]

  • Find a field of a given name if any.

    Parameters

    • name: string

      name of the field to find

    Returns OINODataField

  • Find index of a field of a given name if any.

    Parameters

    • name: string

      name of the field to find

    Returns number

  • Initialize datamodel from SQL schema.

    Returns Promise<void>

  • Print debug information about the fields.

    Parameters

    • separator: string = ""

      string to separate field prints

    Returns string

  • Print all public properties (db, table name, fields) of the datamodel. Used in automated testing validate schema has stayed the same.

    Returns string

  • Print OINO ID of a data row.

    Parameters

    Returns string

  • Print SQL delete statement for id.

    Parameters

    • id: string

      OINO ID (i.e. combined primary key values)

    Returns string

  • Print SQL insert statement from one data row.

    Parameters

    Returns string

  • Print SQL select statement using optional id and filter.

    Parameters

    • id: string

      OINO ID (i.e. combined primary key values)

    • params: OINORequestParams

      OINO reqest params

    Returns string

  • Print SQL insert statement from one data row.

    Parameters

    • id: string

      OINO ID (i.e. combined primary key values)

    • row: OINODataRow

      one row of data in the data model

    Returns string