ORM
  • Introduction
  • Basics of Usage
    • Connecting to the Database
    • Creating a Model
    • Simple Queries
  • Configuration
  • Core Features
    • Models
    • CRUD Operations (Create, Read, Update, Delete): examples
    • Relationships
    • Transactions
  • Advanced Usage
    • Data Definition Language
    • Indexes
    • Triggers
    • Caching
  • Examples and templates
  • Security
    • Query parameterization and protection against SQL injections
    • Logging
    • Monitoring
    • Sanitization
  • ORM-CLI
    • Installing
    • Commands and usage
  • System architecture and implementation
    • Support of various databases
      • Implementation using a pattern strategy
      • Implementation using generics
      • Implementation using metaprogramming
    • Decorators
    • Migrations
      • Assignment of id in Tables and Columns
      • Assigning IDs to indexes and triggers
      • Working with migrations in ORM-CLI
        • Implementation of a pattern command for migration
    • QueryBuilder
    • Caching
    • File structure
  • API
    • Decorators
      • Column
      • ComputedColumn
      • Index
      • ForeignKey
      • PrimaryGeneratedColumn
      • Relations
      • Table
      • Trigger
      • Types decorators
        • Integer
        • Numeric
        • Float
        • Boolean
        • String
    • DDL
    • QueryBuilder
    • Additional API
Powered by GitBook
On this page
  1. API

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.

PreviousQueryBuilder

Last updated 9 months ago