mStorage_api

Mixin. Provide CRUID operations for entity database persistent (ORM) using ubql query syntax

Methods

# addnew (ctx:  object) static

Create record with filled default values and return it to caller. Newly created record is not inserted to database. For inserting record to the database insert method should be called

Arguments:
  • ctx: object
    • entity:  string

      Entity code

    • method:  string

      Should be === 'lock'

    • execParams:  object

      Optional values for attributes of new record

    • fieldList:  array.<string>

      Names of attributes to be returned in result.

# delete (ctx:  object) static

Delete record by ID

Arguments:

# insert (ctx:  object) static

New record insertion

Arguments:
  • ctx: object
    • entity:  string

      Entity code

    • method:  string

      Should be === 'insert'

    • execParams:  object

      Pairs of attributeName: attributeValue to be inserted

    • fieldList:  array.<string>

      Optional names of attributes to be returned in result. Additional DB query is required to return values, so if caller do not need it better to not pass a fieldList to insert

# select (ubql:  object) static

ORM query for read records

Arguments:
  • ubql: object
    • entity:  string

      Entity name

    • method:  string

      Method to use (usually === select)

    • fieldList:  array.<string>

      Attributes expressions

    • whereList:  object.<string, {expression: string, condition: string, value: *}>

      Where conditions

    • groupBy:  array.<string>

      Group by attributes expressions

    • orderBy:  array.<string>

      Order by attributes expressions

    • joinAs:  array.<string>

      Array of condition names to use in join clause instead of where clause of result SQL

    • logicalPredicates:  string

      Optional logical concatenation of WHERE conditions

    • options:  object

      Options for ORM query builder. See CustomRepository.misc documentation for possible values

    ORM query in UBQL format

# update (ctx:  object) static

Update existed record

Arguments:
  • ctx: object
    • entity:  string

      Entity code

    • method:  string

      Should be === 'update'

    • execParams:  Object.<string, *>

      Pairs of attributeName: attributeValue to be updated

    • fieldList:  array.<string>

      Optional names of attributes to be returned in result. Additional DB query is required to return values, so if caller do not need it better to not pass a fieldList to update