Additional API

All other managers included in DatabaseManager are described here

EventManagerInterface & CacheManagerInterface

EventManagerInterface now includes CacheManagerInterface, merging their functionality.

Methods:

  • clearCache:

    • key: Cache key to be cleared (string).

    • Returns: Promise<void> signaling successful cache clearing.

Field:

  • cache: Implementation of CacheManagerInterface that allows cache management.


IndexManagerInterface

Methods:

  • createIndex:

    • index: Object implementing IndexInterface<DT>. Describes the index to be created.

    • id (optional): Identifier of the index.

    • indexName: Name of the index.

    • columns: List of columns included in the index.

    • tableName (optional): Name of the table to which the index is applied.

    • options (optional): Index options specific to the database.

    • getString (optional): Boolean indicating whether to get the query string (boolean).

    • Returns: Promise which may be a string (if getString true) or void.

  • dropIndex:

    • parameters: Object implementing DropIndexInterface<DT>. Describes parameters for dropping the index.

    • indexName: Name of the index.

    • tableName (optional, for MySQL): Name of the table from which the index is being dropped.

    • getString (optional): Boolean indicating whether to get the query string (boolean).

    • Returns: Promise which may be a string (if getString true) or void.


TriggerManagerInterface

Methods:

  • createTrigger:

    • trigger: Object implementing TriggerInterface<DT>. Describes the trigger to be created.

    • id (optional): Identifier of the trigger.

    • name: Name of the trigger.

    • timing: Timing of the trigger, defined in TriggerTimingsTypes.

    • event: Event of the trigger, defined in TriggerEventsTypes.

    • tableName: Name of the table for which the trigger is created.

    • triggerFunction: Function called by the trigger.

    • For PostgreSQL: triggerFunctionName (required).

    • getString (optional): Boolean indicating whether to get the query string (boolean).

    • Returns: Promise which may be a string (if getString true) or void.

  • dropTrigger:

    • parameters: Object implementing DropTriggerInterface<DT>. Describes parameters for dropping the trigger.

    • triggerName: Name of the trigger.

    • tableName (optional, for PostgreSQL): Name of the table from which the trigger is being dropped.

    • getString (optional): Boolean indicating whether to get the query string (boolean).

    • Returns: Promise which may be a string (if getString true) or void.


Overview

  • CacheManagerInterface: Allows managing the cache through the clearCache method, which clears the cache for the specified key.

  • EventManagerInterface: Includes cache management capabilities through CacheManagerInterface and provides access to the cache manager.

  • IndexManagerInterface: Allows creating and dropping indexes in the database, with the option to get SQL queries.

  • TriggerManagerInterface: Allows creating and dropping triggers in the database, with the option to get SQL queries and support for database-specific functions.

Last updated