From c4c428f07b7d4664a526a10b94996c658d25ef54 Mon Sep 17 00:00:00 2001 From: mkloubert Date: Wed, 21 Feb 2024 07:42:34 +0000 Subject: [PATCH] Publish 'docs' to 'gh-pages' in 'egomobile/node-orm' --- classes/DataAdapterBase.html | 36 +++++++++---------- classes/ValidationError.html | 2 +- functions/createDataContext.html | 2 +- functions/getDbValue.html | 2 +- functions/isExplicitNull.html | 2 +- functions/verifyEntityConfigurations.html | 2 +- .../verifyForStrictEntityDocumentation.html | 2 +- interfaces/ICreateDataContextOptions.html | 8 ++--- interfaces/IDataAdapter.html | 22 ++++++------ interfaces/IDataContext.html | 24 ++++++------- interfaces/IDataContextOptions.html | 8 ++--- interfaces/IDataRepository.html | 20 +++++------ interfaces/IEntityConfig.html | 12 +++---- interfaces/IEntityFieldConfig.html | 6 ++-- interfaces/IEntityFieldTransformer.html | 6 ++-- interfaces/IEntityInfo.html | 8 ++--- interfaces/IFindOneOptions.html | 12 +++---- interfaces/IFindOptions.html | 14 ++++---- ...rifyEntityConfigurationsActionContext.html | 6 ++-- .../IVerifyEntityConfigurationsOptions.html | 4 +-- ...fyForStrictEntityDocumentationOptions.html | 4 +-- ...AsyncVerifyEntityConfigurationsAction.html | 2 +- types/DataTransformer.html | 2 +- types/EntityConfigurations.html | 2 +- types/EntityFieldConfigurations.html | 6 ++-- types/Nullable.html | 2 +- .../SyncVerifyEntityConfigurationsAction.html | 2 +- types/VerifyEntityConfigurationsAction.html | 2 +- variables/NULL.html | 2 +- 29 files changed, 111 insertions(+), 111 deletions(-) diff --git a/classes/DataAdapterBase.html b/classes/DataAdapterBase.html index 4c86900..005c5d7 100644 --- a/classes/DataAdapterBase.html +++ b/classes/DataAdapterBase.html @@ -1,5 +1,5 @@ DataAdapterBase | @egomobile/orm

Class DataAdapterBaseAbstract

A basic data adapter.

-

Implements

Constructors

Implements

Constructors

Properties

Accessors

Methods

count @@ -18,55 +18,55 @@ setContext update

Constructors

Properties

_context: Nilable<IDataContext>

The underlying adapter.

-

Accessors

Accessors

Methods

Methods

  • Counts a list of items.

    Type Parameters

    • T extends unknown = any

    Parameters

    • type: Constructor<T>

      The class / type.

    • Optional options: Nilable<IFindOptions>

      The custom options.

    Returns Promise<number>

    The promise with the items.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class User {
    id: number = -1;
    }

    async function countActiveUsers(repo: IDataRepository): Promise<number> {
    // in SQL context
    return await repo.count(User, {
    where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
    params: [ true, false ], // $1, $2
    })
    }
    -
  • Finds a list of items.

    Type Parameters

    • T extends unknown = any

    Parameters

    • type: Constructor<T>

      The class / type.

    • Optional options: Nilable<IFindOptions>

      The custom options.

    Returns Promise<T[]>

    The promise with the items.

    Example

    import { IDataRepository } from '@egomobile/orm'

    // keep sure to initialize your props
    // with a value, which is not (undefined)
    class User {
    id: number = -1;
    first_name: string = '';
    last_name: string = '';
    is_active: boolean | null = null;
    is_deleted: boolean = false;
    }

    async function load10ActiveUsersAndSkipFirst(repo: IDataRepository): Promise<User[]> {
    // in SQL context
    return await repo.find(User, {
    where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
    params: [ true, false ], // $1, $2

    offset: 1,
    limit: 10
    })
    }
    -
  • Tries to find a simple item.

    Type Parameters

    • T extends unknown = any

    Parameters

    • type: Constructor<T>

      The class / type.

    • Optional options: Nilable<IFindOneOptions>

      The custom options.

    Returns Promise<null | T>

    The promise with the item or (null) if not found.

    Example

    import { IDataRepository } from '@egomobile/orm'

    // keep sure to initialize your props
    // with a value, which is not (undefined)
    class User {
    id: number = -1;
    first_name: string = '';
    last_name: string = '';
    is_active: boolean | null = null;
    is_deleted: boolean = false;
    }

    async function loadLastActiveUser(repo: IDataRepository): Promise<User> {
    // in SQL context
    return await repo.findOne(User, {
    where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
    params: [ true, false ], // $1, $2

    sort: {
    'created': 'DESC', // first sort by 'created' (descending)
    'id': 'DESC', // then by 'id' (descending)
    'last_name': 'ASC', // then by 'last_name' (ascending)
    'first_name': 'ASC' // then by 'first_name' (ascending)
    }
    })
    }
    -
  • Returns the list of entity/table fields, which represent the IDs of a row.

    Parameters

    • type: Constructor<any>

      The type.

    Returns string[]

    The list of field names.

    -
  • Returns the list of entity fields columns, which represent the IDs of a row, or throws an exception if not defined.

    Parameters

    • type: Constructor<any>

      The type.

    Returns string[]

    The list of ID fields.

    -
  • Returns the name of the underlying entity/table by type or throws an exception, if not configured.

    +
  • Returns the name of the underlying entity/table by type or throws an exception, if not configured.

    Parameters

    • type: Constructor<any>

      The type.

    Returns string

    The name of the underlying entity/table name.

    -
  • Insert one or more entities.

    Type Parameters

    • T extends unknown = any

    Parameters

    • entityOrEntities: T | List<T>

      The entity to insert.

    Returns Promise<T | T[]>

    The promise with the inserted entity/entities.

    Example

    import { IDataRepository } from '@egomobile/orm'

    // keep sure to initialize your props
    // with a value, which is not (undefined)
    class User {
    id: number | null = null;
    first_name: string = '';
    last_name: string = '';
    is_active: boolean | null = null;
    is_deleted: boolean = false;
    }

    async function createUser(repo: IDataRepository, firstName: string, lastName: string): Promise<User> {
    const newUser = new User()
    newUser.last_name = lastName
    newUser.first_name = firstName
    newUser.is_active = true

    await repo.insert(newUser)
    }
    -
  • Does a raw query.

    Parameters

    • q: any

      The object / value, which represents the query.

    • Rest ...paramsOrArgs: any[]

      A list of optional parameters or arguments for the query.

    Returns Promise<any>

    The promise with the raw result.

    Example

    import { IDataRepository } from '@egomobile/orm'

    async function deleteInactiveUsers(repo: IDataRepository) {
    // in SQL context
    //
    // result is an object or value
    // from the underlying data adapter itself
    const result: any = await repo.query(
    "UPDATE users SET is_deleted=$1 WHERE is_active=$2;",
    false, false // $1, $2
    )
    }
    -
  • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins". The difference to queryAndMap() is, that is makes use of cursor pattern @@ -77,7 +77,7 @@

Returns AsyncGenerator<T, any, unknown>

The async generator.

Example

import { IDataRepository } from '@egomobile/orm'

class UserAndRole {
role_id!: string;
user_id!: string;
}

async function loadUserRoles(repo: IDataRepository): AsyncGenerator<UserAndRole> {
// PostgreSQL example
// s. https://github.com/egomobile/node-orm-pg

return repo.queryAndIterate(
UserAndRole, // type of the target entity
// does not need to be configured
// in data context

// build query
"SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
"FROM user_roles ur " +
"INNER JOIN users u ON u.id = ur.user_id " +
"WHERE u.is_active = $1 AND u.is_deleted = $2;",

// additional parameters
true, false // $1, $2
)
}

const iterator = loadUserRoles(
// ... your repo instance ...
)

for await (const userAndRole of iterator) {
// your code ...
}
-
  • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins".

    Parameters

    • type: Constructor<any>

      The target type.

      @@ -86,16 +86,16 @@

    Returns Promise<any[]>

    The promise with the mapped entities.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class UserAndRole {
    role_id!: string;
    user_id!: string;
    }

    async function loadUserRoles(repo: IDataRepository): Promise<UserAndRole[]> {
    // PostgreSQL example
    // s. https://github.com/egomobile/node-orm-pg

    return await repo.queryAndMap(
    UserAndRole, // type of the target entity
    // does not need to be configured
    // in data context

    // build query
    "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
    "FROM user_roles ur " +
    "INNER JOIN users u ON u.id = ur.user_id " +
    "WHERE u.is_active = $1 AND u.is_deleted = $2;",

    // additional parameters
    true, false // $1, $2
    )
    }
    -
  • Removes one or more entities.

    Type Parameters

    • T extends unknown = any

    Parameters

    • entityOrEntities: T | List<T>

      The entity to remove.

    Returns Promise<T | T[]>

    The promise with the removed entity/entities.

    Example

    import { IDataRepository } from '@egomobile/orm'

    // keep sure to initialize your props
    // with a value, which is not (undefined)
    class User {
    id: number = -1;
    is_active: boolean | null = null;
    }

    async function removeInactiveUsers(repo: IDataRepository, users: User[]) {
    const inactiveUsers = users.find(u => u.is_active === false)

    await repo.remove(inactiveUsers)
    }
    -
  • Updates one or more entities.

    +

Returns this

  • Updates one or more entities.

    Type Parameters

    • T extends unknown = any

    Parameters

    • entityOrEntities: T | List<T>

      The entity to update.

    Returns Promise<T | T[]>

    The promise with the updated entity/entities.

    Example

    import { IDataRepository } from '@egomobile/orm'

    // keep sure to initialize your props
    // with a value, which is not (undefined)
    class User {
    id: number = -1;
    is_deleted: boolean = false;
    }

    async function deleteUsers(repo: IDataRepository, users: User[]) {
    users.forEach((user) => {
    user.is_deleted = true
    })

    await repo.update(inactiveUsers)
    }
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/classes/ValidationError.html b/classes/ValidationError.html index 3e9e2b8..113b95f 100644 --- a/classes/ValidationError.html +++ b/classes/ValidationError.html @@ -1,5 +1,5 @@ ValidationError | @egomobile/orm

Class ValidationError

An error which is thrown if a validation fails.

-

Hierarchy

  • Error
    • ValidationError

Constructors

Hierarchy

  • Error
    • ValidationError

Constructors

Properties

message name stack? diff --git a/functions/createDataContext.html b/functions/createDataContext.html index 3ba322b..0d63065 100644 --- a/functions/createDataContext.html +++ b/functions/createDataContext.html @@ -1,4 +1,4 @@ createDataContext | @egomobile/orm

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/functions/getDbValue.html b/functions/getDbValue.html index 39a3ce6..2a4aa64 100644 --- a/functions/getDbValue.html +++ b/functions/getDbValue.html @@ -3,4 +3,4 @@

Returns T

Is explicit (null) or not.

Example

import { getDbValue, NULL as DbNull, Nullable } from '@egomobile/orm'

const a: Nullable<number> = 0
getDbValue(a) // 0

const b: Nullable<number> = DbNull
getDbValue(b) // (null)
-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/functions/isExplicitNull.html b/functions/isExplicitNull.html index aab1d24..c845c5d 100644 --- a/functions/isExplicitNull.html +++ b/functions/isExplicitNull.html @@ -3,4 +3,4 @@

Returns val is typeof NULL

Is explicit (null) or not.

Example

import { isExplicitNull, NULL } from '@egomobile/orm'

// following values return (true)
isExplicitNull(NULL)
isExplicitNull(Symbol('NULL'))

// anything else is (false)
-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/functions/verifyEntityConfigurations.html b/functions/verifyEntityConfigurations.html index 80c6934..6d55938 100644 --- a/functions/verifyEntityConfigurations.html +++ b/functions/verifyEntityConfigurations.html @@ -3,4 +3,4 @@

Type Parameters

Parameters

Returns Promise<void>

No result here.

-
  • Type Parameters

    Returns void

  • Generated using TypeDoc

    \ No newline at end of file +
  • Type Parameters

    Returns void

  • Generated using TypeDoc

    \ No newline at end of file diff --git a/functions/verifyForStrictEntityDocumentation.html b/functions/verifyForStrictEntityDocumentation.html index b4ccc4a..050cb48 100644 --- a/functions/verifyForStrictEntityDocumentation.html +++ b/functions/verifyForStrictEntityDocumentation.html @@ -2,4 +2,4 @@ If not, if throws an error.

    Type Parameters

    Parameters

    Returns void

    Throws

    ValidationError At least one validation failed.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/ICreateDataContextOptions.html b/interfaces/ICreateDataContextOptions.html index 5c608c4..4fc2de7 100644 --- a/interfaces/ICreateDataContextOptions.html +++ b/interfaces/ICreateDataContextOptions.html @@ -1,10 +1,10 @@ ICreateDataContextOptions | @egomobile/orm

    Interface ICreateDataContextOptions

    Options for 'createDataContext()' function.

    -
    interface ICreateDataContextOptions {
        adapter: IDataAdapter;
        entities: EntityConfigurations;
        noDbNull?: Nilable<boolean>;
    }

    Hierarchy (view full)

    Properties

    interface ICreateDataContextOptions {
        adapter: IDataAdapter;
        entities: EntityConfigurations;
        noDbNull?: Nilable<boolean>;
    }

    Hierarchy (view full)

    Properties

    adapter: IDataAdapter

    The data adapter to use.

    -

    The configurations of all entities / tables.

    -
    noDbNull?: Nilable<boolean>

    Indicates that the special value NULL should not be used +

    The configurations of all entities / tables.

    +
    noDbNull?: Nilable<boolean>

    Indicates that the special value NULL should not be used by default.

    Default

    false

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IDataAdapter.html b/interfaces/IDataAdapter.html index e76fb21..3981b36 100644 --- a/interfaces/IDataAdapter.html +++ b/interfaces/IDataAdapter.html @@ -1,5 +1,5 @@ IDataAdapter | @egomobile/orm

    Interface IDataAdapter

    A data adapter, like a Mongo or PostgreSQL connection.

    -
    interface IDataAdapter {
        count<T>(type, options?): Promise<number>;
        find<T>(type, options?): Promise<T[]>;
        findOne<T>(type, options?): Promise<null | T>;
        insert<T>(entity): Promise<T>;
        insert<T>(entities): Promise<T[]>;
        insert<T>(entityOrEntities): Promise<T | T[]>;
        query<T>(q, ...paramsOrArgs?): Promise<T>;
        queryAndIterate<T>(type, q, ...paramsOrArgs?): AsyncGenerator<T, any, unknown>;
        queryAndMap<T>(type, q, ...paramsOrArgs?): Promise<T[]>;
        remove<T>(entity): Promise<T>;
        remove<T>(entities): Promise<T[]>;
        remove<T>(entityOrEntities): Promise<T | T[]>;
        setContext(context): this;
        update<T>(entity): Promise<T>;
        update<T>(entities): Promise<T[]>;
        update<T>(entityOrEntities): Promise<T | T[]>;
    }

    Hierarchy (view full)

    Implemented by

    Methods

    interface IDataAdapter {
        count<T>(type, options?): Promise<number>;
        find<T>(type, options?): Promise<T[]>;
        findOne<T>(type, options?): Promise<null | T>;
        insert<T>(entity): Promise<T>;
        insert<T>(entities): Promise<T[]>;
        insert<T>(entityOrEntities): Promise<T | T[]>;
        query<T>(q, ...paramsOrArgs?): Promise<T>;
        queryAndIterate<T>(type, q, ...paramsOrArgs?): AsyncGenerator<T, any, unknown>;
        queryAndMap<T>(type, q, ...paramsOrArgs?): Promise<T[]>;
        remove<T>(entity): Promise<T>;
        remove<T>(entities): Promise<T[]>;
        remove<T>(entityOrEntities): Promise<T | T[]>;
        setContext(context): this;
        update<T>(entity): Promise<T>;
        update<T>(entities): Promise<T[]>;
        update<T>(entityOrEntities): Promise<T | T[]>;
    }

    Hierarchy (view full)

    Implemented by

    Methods

    count find findOne insert @@ -15,30 +15,30 @@

    Returns Promise<number>

    The promise with the items.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class User {
    id: number = -1;
    }

    async function countActiveUsers(repo: IDataRepository): Promise<number> {
    // in SQL context
    return await repo.count(User, {
    where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
    params: [ true, false ], // $1, $2
    })
    }
    -
    • Finds a list of items.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOptions>

        The custom options.

      Returns Promise<T[]>

      The promise with the items.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function load10ActiveUsersAndSkipFirst(repo: IDataRepository): Promise<User[]> {
      // in SQL context
      return await repo.find(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2

      offset: 1,
      limit: 10
      })
      }
      -
    • Tries to find a simple item.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOneOptions>

        The custom options.

      Returns Promise<null | T>

      The promise with the item or (null) if not found.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function loadLastActiveUser(repo: IDataRepository): Promise<User> {
      // in SQL context
      return await repo.findOne(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2

      sort: {
      'created': 'DESC', // first sort by 'created' (descending)
      'id': 'DESC', // then by 'id' (descending)
      'last_name': 'ASC', // then by 'last_name' (ascending)
      'first_name': 'ASC' // then by 'first_name' (ascending)
      }
      })
      }
      -
    • Insert one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to insert.

      Returns Promise<T>

      The promise with the inserted entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number | null = null;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function createUser(repo: IDataRepository, firstName: string, lastName: string): Promise<User> {
      const newUser = new User()
      newUser.last_name = lastName
      newUser.first_name = firstName
      newUser.is_active = true

      await repo.insert(newUser)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Does a raw query.

      Type Parameters

      • T extends unknown = any

      Parameters

      • q: any

        The object / value, which represents the query.

      • Optional Rest ...paramsOrArgs: any[]

        A list of optional parameters or arguments for the query.

      Returns Promise<T>

      The promise with the raw result.

      Example

      import { IDataRepository } from '@egomobile/orm'

      async function deleteInactiveUsers(repo: IDataRepository) {
      // in SQL context
      //
      // result is an object or value
      // from the underlying data adapter itself
      const result: any = await repo.query(
      "UPDATE users SET is_deleted=$1 WHERE is_active=$2;",
      false, false // $1, $2
      )
      }
      -
    • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins". The difference to queryAndMap() is, that is makes use of cursor pattern @@ -49,7 +49,7 @@

    Returns AsyncGenerator<T, any, unknown>

    The async generator.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class UserAndRole {
    role_id!: string;
    user_id!: string;
    }

    async function loadUserRoles(repo: IDataRepository): AsyncGenerator<UserAndRole> {
    // PostgreSQL example
    // s. https://github.com/egomobile/node-orm-pg

    return repo.queryAndIterate(
    UserAndRole, // type of the target entity
    // does not need to be configured
    // in data context

    // build query
    "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
    "FROM user_roles ur " +
    "INNER JOIN users u ON u.id = ur.user_id " +
    "WHERE u.is_active = $1 AND u.is_deleted = $2;",

    // additional parameters
    true, false // $1, $2
    )
    }

    const iterator = loadUserRoles(
    // ... your repo instance ...
    )

    for await (const userAndRole of iterator) {
    // your code ...
    }
    -
    • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins".

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The target type.

        @@ -58,16 +58,16 @@

      Returns Promise<T[]>

      The promise with the mapped entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      class UserAndRole {
      role_id!: string;
      user_id!: string;
      }

      async function loadUserRoles(repo: IDataRepository): Promise<UserAndRole[]> {
      // PostgreSQL example
      // s. https://github.com/egomobile/node-orm-pg

      return await repo.queryAndMap(
      UserAndRole, // type of the target entity
      // does not need to be configured
      // in data context

      // build query
      "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
      "FROM user_roles ur " +
      "INNER JOIN users u ON u.id = ur.user_id " +
      "WHERE u.is_active = $1 AND u.is_deleted = $2;",

      // additional parameters
      true, false // $1, $2
      )
      }
      -
    • Removes one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to remove.

      Returns Promise<T>

      The promise with the removed entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      is_active: boolean | null = null;
      }

      async function removeInactiveUsers(repo: IDataRepository, users: User[]) {
      const inactiveUsers = users.find(u => u.is_active === false)

      await repo.remove(inactiveUsers)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Updates one or more entities.

      +

    Returns this

    • Updates one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to update.

      Returns Promise<T>

      The promise with the updated entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      is_deleted: boolean = false;
      }

      async function deleteUsers(repo: IDataRepository, users: User[]) {
      users.forEach((user) => {
      user.is_deleted = true
      })

      await repo.update(inactiveUsers)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    Generated using TypeDoc

    \ No newline at end of file +
  • Type Parameters

    • T extends unknown = any

    Parameters

    • entities: List<T>

    Returns Promise<T[]>

  • Type Parameters

    • T extends unknown = any

    Parameters

    • entityOrEntities: T | List<T>

    Returns Promise<T | T[]>

  • Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IDataContext.html b/interfaces/IDataContext.html index c003a80..f65cfed 100644 --- a/interfaces/IDataContext.html +++ b/interfaces/IDataContext.html @@ -1,5 +1,5 @@ IDataContext | @egomobile/orm

    Interface IDataContext

    A data context.

    -
    interface IDataContext {
        entities: EntityConfigurations;
        noDbNull: boolean;
        count<T>(type, options?): Promise<number>;
        find<T>(type, options?): Promise<T[]>;
        findOne<T>(type, options?): Promise<null | T>;
        insert<T>(entity): Promise<T>;
        insert<T>(entities): Promise<T[]>;
        insert<T>(entityOrEntities): Promise<T | T[]>;
        query<T>(q, ...paramsOrArgs?): Promise<T>;
        queryAndIterate<T>(type, q, ...paramsOrArgs?): AsyncGenerator<T, any, unknown>;
        queryAndMap<T>(type, q, ...paramsOrArgs?): Promise<T[]>;
        remove<T>(entity): Promise<T>;
        remove<T>(entities): Promise<T[]>;
        remove<T>(entityOrEntities): Promise<T | T[]>;
        update<T>(entity): Promise<T>;
        update<T>(entities): Promise<T[]>;
        update<T>(entityOrEntities): Promise<T | T[]>;
    }

    Hierarchy (view full)

    Properties

    interface IDataContext {
        entities: EntityConfigurations;
        noDbNull: boolean;
        count<T>(type, options?): Promise<number>;
        find<T>(type, options?): Promise<T[]>;
        findOne<T>(type, options?): Promise<null | T>;
        insert<T>(entity): Promise<T>;
        insert<T>(entities): Promise<T[]>;
        insert<T>(entityOrEntities): Promise<T | T[]>;
        query<T>(q, ...paramsOrArgs?): Promise<T>;
        queryAndIterate<T>(type, q, ...paramsOrArgs?): AsyncGenerator<T, any, unknown>;
        queryAndMap<T>(type, q, ...paramsOrArgs?): Promise<T[]>;
        remove<T>(entity): Promise<T>;
        remove<T>(entities): Promise<T[]>;
        remove<T>(entityOrEntities): Promise<T | T[]>;
        update<T>(entity): Promise<T>;
        update<T>(entities): Promise<T[]>;
        update<T>(entityOrEntities): Promise<T | T[]>;
    }

    Hierarchy (view full)

    Properties

    Methods

    count find @@ -11,37 +11,37 @@ remove update

    Properties

    The list of entity configurations.

    -
    noDbNull: boolean

    Default value, which indicates if DbNull value should not be used.

    -

    Methods

    noDbNull: boolean

    Default value, which indicates if DbNull value should not be used.

    +

    Methods

    • Counts a list of items.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOptions>

        The custom options.

      Returns Promise<number>

      The promise with the items.

      Example

      import { IDataRepository } from '@egomobile/orm'

      class User {
      id: number = -1;
      }

      async function countActiveUsers(repo: IDataRepository): Promise<number> {
      // in SQL context
      return await repo.count(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2
      })
      }
      -
    • Finds a list of items.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOptions>

        The custom options.

      Returns Promise<T[]>

      The promise with the items.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function load10ActiveUsersAndSkipFirst(repo: IDataRepository): Promise<User[]> {
      // in SQL context
      return await repo.find(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2

      offset: 1,
      limit: 10
      })
      }
      -
    • Tries to find a simple item.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOneOptions>

        The custom options.

      Returns Promise<null | T>

      The promise with the item or (null) if not found.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function loadLastActiveUser(repo: IDataRepository): Promise<User> {
      // in SQL context
      return await repo.findOne(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2

      sort: {
      'created': 'DESC', // first sort by 'created' (descending)
      'id': 'DESC', // then by 'id' (descending)
      'last_name': 'ASC', // then by 'last_name' (ascending)
      'first_name': 'ASC' // then by 'first_name' (ascending)
      }
      })
      }
      -
    • Insert one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to insert.

      Returns Promise<T>

      The promise with the inserted entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number | null = null;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function createUser(repo: IDataRepository, firstName: string, lastName: string): Promise<User> {
      const newUser = new User()
      newUser.last_name = lastName
      newUser.first_name = firstName
      newUser.is_active = true

      await repo.insert(newUser)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Does a raw query.

      Type Parameters

      • T extends unknown = any

      Parameters

      • q: any

        The object / value, which represents the query.

      • Optional Rest ...paramsOrArgs: any[]

        A list of optional parameters or arguments for the query.

      Returns Promise<T>

      The promise with the raw result.

      Example

      import { IDataRepository } from '@egomobile/orm'

      async function deleteInactiveUsers(repo: IDataRepository) {
      // in SQL context
      //
      // result is an object or value
      // from the underlying data adapter itself
      const result: any = await repo.query(
      "UPDATE users SET is_deleted=$1 WHERE is_active=$2;",
      false, false // $1, $2
      )
      }
      -
    • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins". The difference to queryAndMap() is, that is makes use of cursor pattern @@ -52,7 +52,7 @@

    Returns AsyncGenerator<T, any, unknown>

    The async generator.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class UserAndRole {
    role_id!: string;
    user_id!: string;
    }

    async function loadUserRoles(repo: IDataRepository): AsyncGenerator<UserAndRole> {
    // PostgreSQL example
    // s. https://github.com/egomobile/node-orm-pg

    return repo.queryAndIterate(
    UserAndRole, // type of the target entity
    // does not need to be configured
    // in data context

    // build query
    "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
    "FROM user_roles ur " +
    "INNER JOIN users u ON u.id = ur.user_id " +
    "WHERE u.is_active = $1 AND u.is_deleted = $2;",

    // additional parameters
    true, false // $1, $2
    )
    }

    const iterator = loadUserRoles(
    // ... your repo instance ...
    )

    for await (const userAndRole of iterator) {
    // your code ...
    }
    -
    • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins".

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The target type.

        @@ -61,14 +61,14 @@

      Returns Promise<T[]>

      The promise with the mapped entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      class UserAndRole {
      role_id!: string;
      user_id!: string;
      }

      async function loadUserRoles(repo: IDataRepository): Promise<UserAndRole[]> {
      // PostgreSQL example
      // s. https://github.com/egomobile/node-orm-pg

      return await repo.queryAndMap(
      UserAndRole, // type of the target entity
      // does not need to be configured
      // in data context

      // build query
      "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
      "FROM user_roles ur " +
      "INNER JOIN users u ON u.id = ur.user_id " +
      "WHERE u.is_active = $1 AND u.is_deleted = $2;",

      // additional parameters
      true, false // $1, $2
      )
      }
      -
    • Removes one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to remove.

      Returns Promise<T>

      The promise with the removed entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      is_active: boolean | null = null;
      }

      async function removeInactiveUsers(repo: IDataRepository, users: User[]) {
      const inactiveUsers = users.find(u => u.is_active === false)

      await repo.remove(inactiveUsers)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Updates one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to update.

      Returns Promise<T>

      The promise with the updated entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      is_deleted: boolean = false;
      }

      async function deleteUsers(repo: IDataRepository, users: User[]) {
      users.forEach((user) => {
      user.is_deleted = true
      })

      await repo.update(inactiveUsers)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    Generated using TypeDoc

    \ No newline at end of file +
  • Type Parameters

    • T extends unknown = any

    Parameters

    • entities: List<T>

    Returns Promise<T[]>

  • Type Parameters

    • T extends unknown = any

    Parameters

    • entityOrEntities: T | List<T>

    Returns Promise<T | T[]>

  • Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IDataContextOptions.html b/interfaces/IDataContextOptions.html index 1f6712f..7f565ef 100644 --- a/interfaces/IDataContextOptions.html +++ b/interfaces/IDataContextOptions.html @@ -1,10 +1,10 @@ IDataContextOptions | @egomobile/orm

    Interface IDataContextOptions

    Options for a data context.

    -
    interface IDataContextOptions {
        adapter: IDataAdapter;
        entities: EntityConfigurations;
        noDbNull?: Nilable<boolean>;
    }

    Hierarchy (view full)

    Properties

    interface IDataContextOptions {
        adapter: IDataAdapter;
        entities: EntityConfigurations;
        noDbNull?: Nilable<boolean>;
    }

    Hierarchy (view full)

    Properties

    adapter: IDataAdapter

    The data adapter to use.

    -

    The configurations of all entities / tables.

    -
    noDbNull?: Nilable<boolean>

    Indicates that the special value NULL should not be used +

    The configurations of all entities / tables.

    +
    noDbNull?: Nilable<boolean>

    Indicates that the special value NULL should not be used by default.

    Default

    false

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IDataRepository.html b/interfaces/IDataRepository.html index 7b1c88d..8dcc606 100644 --- a/interfaces/IDataRepository.html +++ b/interfaces/IDataRepository.html @@ -1,5 +1,5 @@ IDataRepository | @egomobile/orm

    Interface IDataRepository

    A data repository.

    -
    interface IDataRepository {
        count<T>(type, options?): Promise<number>;
        find<T>(type, options?): Promise<T[]>;
        findOne<T>(type, options?): Promise<null | T>;
        insert<T>(entity): Promise<T>;
        insert<T>(entities): Promise<T[]>;
        insert<T>(entityOrEntities): Promise<T | T[]>;
        query<T>(q, ...paramsOrArgs?): Promise<T>;
        queryAndIterate<T>(type, q, ...paramsOrArgs?): AsyncGenerator<T, any, unknown>;
        queryAndMap<T>(type, q, ...paramsOrArgs?): Promise<T[]>;
        remove<T>(entity): Promise<T>;
        remove<T>(entities): Promise<T[]>;
        remove<T>(entityOrEntities): Promise<T | T[]>;
        update<T>(entity): Promise<T>;
        update<T>(entities): Promise<T[]>;
        update<T>(entityOrEntities): Promise<T | T[]>;
    }

    Hierarchy (view full)

    Methods

    interface IDataRepository {
        count<T>(type, options?): Promise<number>;
        find<T>(type, options?): Promise<T[]>;
        findOne<T>(type, options?): Promise<null | T>;
        insert<T>(entity): Promise<T>;
        insert<T>(entities): Promise<T[]>;
        insert<T>(entityOrEntities): Promise<T | T[]>;
        query<T>(q, ...paramsOrArgs?): Promise<T>;
        queryAndIterate<T>(type, q, ...paramsOrArgs?): AsyncGenerator<T, any, unknown>;
        queryAndMap<T>(type, q, ...paramsOrArgs?): Promise<T[]>;
        remove<T>(entity): Promise<T>;
        remove<T>(entities): Promise<T[]>;
        remove<T>(entityOrEntities): Promise<T | T[]>;
        update<T>(entity): Promise<T>;
        update<T>(entities): Promise<T[]>;
        update<T>(entityOrEntities): Promise<T | T[]>;
    }

    Hierarchy (view full)

    Methods

    count find findOne insert @@ -14,30 +14,30 @@

    Returns Promise<number>

    The promise with the items.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class User {
    id: number = -1;
    }

    async function countActiveUsers(repo: IDataRepository): Promise<number> {
    // in SQL context
    return await repo.count(User, {
    where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
    params: [ true, false ], // $1, $2
    })
    }
    -
    • Finds a list of items.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOptions>

        The custom options.

      Returns Promise<T[]>

      The promise with the items.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function load10ActiveUsersAndSkipFirst(repo: IDataRepository): Promise<User[]> {
      // in SQL context
      return await repo.find(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2

      offset: 1,
      limit: 10
      })
      }
      -
    • Tries to find a simple item.

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The class / type.

      • Optional options: Nilable<IFindOneOptions>

        The custom options.

      Returns Promise<null | T>

      The promise with the item or (null) if not found.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function loadLastActiveUser(repo: IDataRepository): Promise<User> {
      // in SQL context
      return await repo.findOne(User, {
      where: 'is_active=$1 AND (is_deleted=$2 OR is_deleted IS NULL)',
      params: [ true, false ], // $1, $2

      sort: {
      'created': 'DESC', // first sort by 'created' (descending)
      'id': 'DESC', // then by 'id' (descending)
      'last_name': 'ASC', // then by 'last_name' (ascending)
      'first_name': 'ASC' // then by 'first_name' (ascending)
      }
      })
      }
      -
    • Insert one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to insert.

      Returns Promise<T>

      The promise with the inserted entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number | null = null;
      first_name: string = '';
      last_name: string = '';
      is_active: boolean | null = null;
      is_deleted: boolean = false;
      }

      async function createUser(repo: IDataRepository, firstName: string, lastName: string): Promise<User> {
      const newUser = new User()
      newUser.last_name = lastName
      newUser.first_name = firstName
      newUser.is_active = true

      await repo.insert(newUser)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Does a raw query.

      +
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Does a raw query.

      Type Parameters

      • T extends unknown = any

      Parameters

      • q: any

        The object / value, which represents the query.

      • Optional Rest ...paramsOrArgs: any[]

        A list of optional parameters or arguments for the query.

      Returns Promise<T>

      The promise with the raw result.

      Example

      import { IDataRepository } from '@egomobile/orm'

      async function deleteInactiveUsers(repo: IDataRepository) {
      // in SQL context
      //
      // result is an object or value
      // from the underlying data adapter itself
      const result: any = await repo.query(
      "UPDATE users SET is_deleted=$1 WHERE is_active=$2;",
      false, false // $1, $2
      )
      }
      -
    • Does a raw query and maps the result(s) to entity objects. +

    • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins". The difference to queryAndMap() is, that is makes use of cursor pattern @@ -48,7 +48,7 @@

    Returns AsyncGenerator<T, any, unknown>

    The async generator.

    Example

    import { IDataRepository } from '@egomobile/orm'

    class UserAndRole {
    role_id!: string;
    user_id!: string;
    }

    async function loadUserRoles(repo: IDataRepository): AsyncGenerator<UserAndRole> {
    // PostgreSQL example
    // s. https://github.com/egomobile/node-orm-pg

    return repo.queryAndIterate(
    UserAndRole, // type of the target entity
    // does not need to be configured
    // in data context

    // build query
    "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
    "FROM user_roles ur " +
    "INNER JOIN users u ON u.id = ur.user_id " +
    "WHERE u.is_active = $1 AND u.is_deleted = $2;",

    // additional parameters
    true, false // $1, $2
    )
    }

    const iterator = loadUserRoles(
    // ... your repo instance ...
    )

    for await (const userAndRole of iterator) {
    // your code ...
    }
    -
    • Does a raw query and maps the result(s) to entity objects. +

    • Does a raw query and maps the result(s) to entity objects. The classes do not need to be configured in context, so it is possbile to implement and work with "joins".

      Type Parameters

      • T extends unknown = any

      Parameters

      • type: Constructor<T>

        The target type.

        @@ -57,14 +57,14 @@

      Returns Promise<T[]>

      The promise with the mapped entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      class UserAndRole {
      role_id!: string;
      user_id!: string;
      }

      async function loadUserRoles(repo: IDataRepository): Promise<UserAndRole[]> {
      // PostgreSQL example
      // s. https://github.com/egomobile/node-orm-pg

      return await repo.queryAndMap(
      UserAndRole, // type of the target entity
      // does not need to be configured
      // in data context

      // build query
      "SELECT DISTINCT ur.id AS role_id, u.id AS user_id " +
      "FROM user_roles ur " +
      "INNER JOIN users u ON u.id = ur.user_id " +
      "WHERE u.is_active = $1 AND u.is_deleted = $2;",

      // additional parameters
      true, false // $1, $2
      )
      }
      -
    • Removes one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to remove.

      Returns Promise<T>

      The promise with the removed entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      is_active: boolean | null = null;
      }

      async function removeInactiveUsers(repo: IDataRepository, users: User[]) {
      const inactiveUsers = users.find(u => u.is_active === false)

      await repo.remove(inactiveUsers)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Updates one or more entities.

      +
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    • Updates one or more entities.

      Type Parameters

      • T extends unknown = any

      Parameters

      • entity: T

        The entity to update.

      Returns Promise<T>

      The promise with the updated entity/entities.

      Example

      import { IDataRepository } from '@egomobile/orm'

      // keep sure to initialize your props
      // with a value, which is not (undefined)
      class User {
      id: number = -1;
      is_deleted: boolean = false;
      }

      async function deleteUsers(repo: IDataRepository, users: User[]) {
      users.forEach((user) => {
      user.is_deleted = true
      })

      await repo.update(inactiveUsers)
      }
      -
    • Type Parameters

      • T extends unknown = any

      Parameters

      • entities: List<T>

      Returns Promise<T[]>

    • Type Parameters

      • T extends unknown = any

      Parameters

      • entityOrEntities: T | List<T>

      Returns Promise<T | T[]>

    Generated using TypeDoc

    \ No newline at end of file +
  • Type Parameters

    • T extends unknown = any

    Parameters

    • entities: List<T>

    Returns Promise<T[]>

  • Type Parameters

    • T extends unknown = any

    Parameters

    • entityOrEntities: T | List<T>

    Returns Promise<T | T[]>

  • Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IEntityConfig.html b/interfaces/IEntityConfig.html index e5f1774..3683edf 100644 --- a/interfaces/IEntityConfig.html +++ b/interfaces/IEntityConfig.html @@ -1,13 +1,13 @@ IEntityConfig | @egomobile/orm

    Interface IEntityConfig<TEntity>

    A configuration for an entity.

    -
    interface IEntityConfig<TEntity> {
        comment?: Nilable<string>;
        fields?: Nilable<EntityFieldConfigurations<TEntity>>;
        ids?: Nilable<string[]>;
        noDbNull?: Nilable<boolean>;
        type: TEntity;
    }

    Type Parameters

    • TEntity extends Constructor<unknown> = Constructor<any>

    Properties

    interface IEntityConfig<TEntity> {
        comment?: Nilable<string>;
        fields?: Nilable<EntityFieldConfigurations>;
        ids?: Nilable<string[]>;
        noDbNull?: Nilable<boolean>;
        type: TEntity;
    }

    Type Parameters

    • TEntity extends Constructor<any> = Constructor<any>

    Properties

    comment?: Nilable<string>

    A comment (or description) for this entity, which can be used as documentation later, e.g.

    -

    The custom field configurations.

    -
    ids?: Nilable<string[]>

    List of columns / fields which representthe ID.

    -
    noDbNull?: Nilable<boolean>

    Indicates that the special value NULL should not be used +

    fields?: Nilable<EntityFieldConfigurations>

    The custom field configurations.

    +
    ids?: Nilable<string[]>

    List of columns / fields which representthe ID.

    +
    noDbNull?: Nilable<boolean>

    Indicates that the special value NULL should not be used for this entity.

    -
    type: TEntity

    The class / type to use to create instances for an entity.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    type: TEntity

    The class / type to use to create instances for an entity.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IEntityFieldConfig.html b/interfaces/IEntityFieldConfig.html index 542c5eb..b10627c 100644 --- a/interfaces/IEntityFieldConfig.html +++ b/interfaces/IEntityFieldConfig.html @@ -1,6 +1,6 @@ IEntityFieldConfig | @egomobile/orm

    Interface IEntityFieldConfig

    A configuration for an entity field.

    -
    interface IEntityFieldConfig {
        comment?: Nilable<string>;
        transformer?: Nilable<IEntityFieldTransformer>;
    }

    Properties

    interface IEntityFieldConfig {
        comment?: Nilable<string>;
        transformer?: Nilable<IEntityFieldTransformer>;
    }

    Properties

    comment?: Nilable<string>

    A comment (or description) for this field, which can be used as documentation later, e.g.

    -
    transformer?: Nilable<IEntityFieldTransformer>

    The custom and optional data transformer.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    transformer?: Nilable<IEntityFieldTransformer>

    The custom and optional data transformer.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IEntityFieldTransformer.html b/interfaces/IEntityFieldTransformer.html index fc690d4..7b5c0d4 100644 --- a/interfaces/IEntityFieldTransformer.html +++ b/interfaces/IEntityFieldTransformer.html @@ -1,9 +1,9 @@ IEntityFieldTransformer | @egomobile/orm

    Interface IEntityFieldTransformer

    An object, which transforms the data of a field.

    -
    interface IEntityFieldTransformer {
        from?: Nilable<DataTransformer>;
        to?: Nilable<DataTransformer>;
    }

    Properties

    interface IEntityFieldTransformer {
        from?: Nilable<DataTransformer>;
        to?: Nilable<DataTransformer>;
    }

    Properties

    Properties

    from?: Nilable<DataTransformer>

    The optional action to invoke, when data comes from database to entity.

    -
    to?: Nilable<DataTransformer>

    The optional action to invoke, when +

    to?: Nilable<DataTransformer>

    The optional action to invoke, when data of an entity field is written to database.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IEntityInfo.html b/interfaces/IEntityInfo.html index 85e8152..625e375 100644 --- a/interfaces/IEntityInfo.html +++ b/interfaces/IEntityInfo.html @@ -1,8 +1,8 @@ IEntityInfo | @egomobile/orm

    Interface IEntityInfo

    Result of a DataAdapterBase.getEntityByType() call.

    -
    interface IEntityInfo {
        config: IEntityConfig<Constructor<any>>;
        name: string;
        noDbNull: boolean;
    }

    Properties

    interface IEntityInfo {
        config: IEntityConfig<Constructor<any>>;
        name: string;
        noDbNull: boolean;
    }

    Properties

    Properties

    config: IEntityConfig<Constructor<any>>

    The underlying config.

    -
    name: string

    The name.

    -
    noDbNull: boolean

    Values, that indicates, if DbNull should be used or not.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    name: string

    The name.

    +
    noDbNull: boolean

    Values, that indicates, if DbNull should be used or not.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IFindOneOptions.html b/interfaces/IFindOneOptions.html index c63efd8..422c782 100644 --- a/interfaces/IFindOneOptions.html +++ b/interfaces/IFindOneOptions.html @@ -1,12 +1,12 @@ IFindOneOptions | @egomobile/orm

    Interface IFindOneOptions

    Options for finding one single entity.

    -
    interface IFindOneOptions {
        fields?: Nilable<any[]>;
        offset?: Nilable<number>;
        params?: any;
        sort?: any;
        where?: any;
    }

    Hierarchy (view full)

    Properties

    interface IFindOneOptions {
        fields?: Nilable<any[]>;
        offset?: Nilable<number>;
        params?: any;
        sort?: any;
        where?: any;
    }

    Hierarchy (view full)

    Properties

    fields?: Nilable<any[]>

    Custom list of fields / columns.

    -
    offset?: Nilable<number>

    The number of items to skip. Default: 0

    -
    params?: any

    An object that represents the parameters for the 'where' part.

    -
    sort?: any

    An object, which is used to sort the result.

    -
    where?: any

    An object, which is used to filter the result.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    offset?: Nilable<number>

    The number of items to skip. Default: 0

    +
    params?: any

    An object that represents the parameters for the 'where' part.

    +
    sort?: any

    An object, which is used to sort the result.

    +
    where?: any

    An object, which is used to filter the result.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IFindOptions.html b/interfaces/IFindOptions.html index 34385e7..0e9e7d6 100644 --- a/interfaces/IFindOptions.html +++ b/interfaces/IFindOptions.html @@ -1,14 +1,14 @@ IFindOptions | @egomobile/orm

    Interface IFindOptions

    Options for finding entities.

    -
    interface IFindOptions {
        fields?: Nilable<any[]>;
        limit?: Nilable<number>;
        offset?: Nilable<number>;
        params?: any;
        sort?: any;
        where?: any;
    }

    Hierarchy (view full)

    Properties

    interface IFindOptions {
        fields?: Nilable<any[]>;
        limit?: Nilable<number>;
        offset?: Nilable<number>;
        params?: any;
        sort?: any;
        where?: any;
    }

    Hierarchy (view full)

    Properties

    fields?: Nilable<any[]>

    Custom list of fields / columns.

    -
    limit?: Nilable<number>

    The maximum number of items. Default: no limit

    -
    offset?: Nilable<number>

    The number of items to skip. Default: 0

    -
    params?: any

    An object that represents the parameters for the 'where' part.

    -
    sort?: any

    An object, which is used to sort the result.

    -
    where?: any

    An object, which is used to filter the result.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    limit?: Nilable<number>

    The maximum number of items. Default: no limit

    +
    offset?: Nilable<number>

    The number of items to skip. Default: 0

    +
    params?: any

    An object that represents the parameters for the 'where' part.

    +
    sort?: any

    An object, which is used to sort the result.

    +
    where?: any

    An object, which is used to filter the result.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IVerifyEntityConfigurationsActionContext.html b/interfaces/IVerifyEntityConfigurationsActionContext.html index 3640619..66b4431 100644 --- a/interfaces/IVerifyEntityConfigurationsActionContext.html +++ b/interfaces/IVerifyEntityConfigurationsActionContext.html @@ -1,8 +1,8 @@ IVerifyEntityConfigurationsActionContext | @egomobile/orm

    Interface IVerifyEntityConfigurationsActionContext<TConfig>

    A context for a VerifyEntityConfigurationsAction function.

    -
    interface IVerifyEntityConfigurationsActionContext<TConfig> {
        entity: {
            config: TConfig[keyof TConfig];
            name: keyof TConfig;
        };
        validationError?: Nilable<string>;
    }

    Type Parameters

    Properties

    interface IVerifyEntityConfigurationsActionContext<TConfig> {
        entity: {
            config: TConfig[keyof TConfig];
            name: keyof TConfig;
        };
        validationError?: Nilable<string>;
    }

    Type Parameters

    Properties

    entity: {
        config: TConfig[keyof TConfig];
        name: keyof TConfig;
    }

    The current entity.

    Type declaration

    validationError?: Nilable<string>

    A non-empty value that represents a validation error.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    validationError?: Nilable<string>

    A non-empty value that represents a validation error.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IVerifyEntityConfigurationsOptions.html b/interfaces/IVerifyEntityConfigurationsOptions.html index 01263c2..d084915 100644 --- a/interfaces/IVerifyEntityConfigurationsOptions.html +++ b/interfaces/IVerifyEntityConfigurationsOptions.html @@ -1,4 +1,4 @@ IVerifyEntityConfigurationsOptions | @egomobile/orm

    Interface IVerifyEntityConfigurationsOptions<TConfig>

    Options for verifyEntityConfigurations() function.

    -
    interface IVerifyEntityConfigurationsOptions<TConfig> {
        configurations: TConfig;
    }

    Type Parameters

    Hierarchy (view full)

    Properties

    interface IVerifyEntityConfigurationsOptions<TConfig> {
        configurations: TConfig;
    }

    Type Parameters

    Hierarchy (view full)

    Properties

    Properties

    configurations: TConfig

    The configuration.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/interfaces/IVerifyForStrictEntityDocumentationOptions.html b/interfaces/IVerifyForStrictEntityDocumentationOptions.html index 2f897cc..fbf48be 100644 --- a/interfaces/IVerifyForStrictEntityDocumentationOptions.html +++ b/interfaces/IVerifyForStrictEntityDocumentationOptions.html @@ -1,4 +1,4 @@ IVerifyForStrictEntityDocumentationOptions | @egomobile/orm

    Interface IVerifyForStrictEntityDocumentationOptions<TConfig>

    Options for verifyForStrictEntityDocumentation() function.

    -
    interface IVerifyForStrictEntityDocumentationOptions<TConfig> {
        configurations: TConfig;
    }

    Type Parameters

    Hierarchy (view full)

    Properties

    interface IVerifyForStrictEntityDocumentationOptions<TConfig> {
        configurations: TConfig;
    }

    Type Parameters

    Hierarchy (view full)

    Properties

    Properties

    configurations: TConfig

    The configuration.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/AsyncVerifyEntityConfigurationsAction.html b/types/AsyncVerifyEntityConfigurationsAction.html index fbcc3d9..d0bfe00 100644 --- a/types/AsyncVerifyEntityConfigurationsAction.html +++ b/types/AsyncVerifyEntityConfigurationsAction.html @@ -1,2 +1,2 @@ AsyncVerifyEntityConfigurationsAction | @egomobile/orm

    Type alias AsyncVerifyEntityConfigurationsAction<TConfig>

    AsyncVerifyEntityConfigurationsAction<TConfig>: ((context) => PromiseLike<void>)

    An async action used by verifyEntityConfigurations() function.

    -

    Type Parameters

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/DataTransformer.html b/types/DataTransformer.html index b750e64..e8e4ec0 100644 --- a/types/DataTransformer.html +++ b/types/DataTransformer.html @@ -1,4 +1,4 @@ DataTransformer | @egomobile/orm

    Type alias DataTransformer

    DataTransformer: ((value) => any)

    An action, which transforms data.

    Type declaration

      • (value): any
      • Parameters

        • value: any

          The input value.

        Returns any

    Returns

    The output value.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/EntityConfigurations.html b/types/EntityConfigurations.html index 731b5f3..03363fb 100644 --- a/types/EntityConfigurations.html +++ b/types/EntityConfigurations.html @@ -1,3 +1,3 @@ EntityConfigurations | @egomobile/orm

    Type alias EntityConfigurations

    EntityConfigurations: {
        [entityName: string]: IEntityConfig;
    }

    Object with entity configurations.

    Type declaration

    • [entityName: string]: IEntityConfig

      List of IEntityConfigs grouped by their entity / table names.

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/EntityFieldConfigurations.html b/types/EntityFieldConfigurations.html index a916e18..6fc2270 100644 --- a/types/EntityFieldConfigurations.html +++ b/types/EntityFieldConfigurations.html @@ -1,3 +1,3 @@ -EntityFieldConfigurations | @egomobile/orm

    Type alias EntityFieldConfigurations<TEntity>

    EntityFieldConfigurations<TEntity>: {
        [fieldName: string]: IEntityFieldConfig;
    }

    Object with entity configurations.

    -

    Type Parameters

    • TEntity extends Constructor<unknown> = Constructor<any>

    Type declaration

    • [fieldName: string]: IEntityFieldConfig

      List of IEntityFieldConfigs grouped by their attribute / column names.

      -

    Generated using TypeDoc

    \ No newline at end of file +EntityFieldConfigurations | @egomobile/orm

    Type alias EntityFieldConfigurations

    EntityFieldConfigurations: {
        [fieldName: string]: IEntityFieldConfig;
    }

    Object with entity configurations.

    +

    Type declaration

    • [fieldName: string]: IEntityFieldConfig

      List of IEntityFieldConfigs grouped by their attribute / column names.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/Nullable.html b/types/Nullable.html index 2b7a1bb..c8255e7 100644 --- a/types/Nullable.html +++ b/types/Nullable.html @@ -1,2 +1,2 @@ Nullable | @egomobile/orm

    Type alias Nullable<T>

    Nullable<T>: T | typeof NULL

    A data(-base) value, which can also be (null) or something like that.

    -

    Type Parameters

    • T extends any = any

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/SyncVerifyEntityConfigurationsAction.html b/types/SyncVerifyEntityConfigurationsAction.html index eeb2321..6d260f2 100644 --- a/types/SyncVerifyEntityConfigurationsAction.html +++ b/types/SyncVerifyEntityConfigurationsAction.html @@ -1,2 +1,2 @@ SyncVerifyEntityConfigurationsAction | @egomobile/orm

    Type alias SyncVerifyEntityConfigurationsAction<TConfig>

    SyncVerifyEntityConfigurationsAction<TConfig>: ((context) => void)

    An sync action used by verifyEntityConfigurations() function.

    -

    Type Parameters

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    Type declaration

    Generated using TypeDoc

    \ No newline at end of file diff --git a/types/VerifyEntityConfigurationsAction.html b/types/VerifyEntityConfigurationsAction.html index 6a289fb..f9e4084 100644 --- a/types/VerifyEntityConfigurationsAction.html +++ b/types/VerifyEntityConfigurationsAction.html @@ -1,2 +1,2 @@ VerifyEntityConfigurationsAction | @egomobile/orm

    Type alias VerifyEntityConfigurationsAction<TConfig>

    Possible value for an action used by verifyEntityConfigurations() function.

    -

    Type Parameters

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    Generated using TypeDoc

    \ No newline at end of file diff --git a/variables/NULL.html b/variables/NULL.html index bca10fa..339fa6a 100644 --- a/variables/NULL.html +++ b/variables/NULL.html @@ -1,2 +1,2 @@ NULL | @egomobile/orm

    Variable NULLConst

    NULL: typeof NULL = ...

    An unique value, which represents

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file