Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DB

A class representing a connection to a SQL database.

Hierarchy

  • DB

Index

Constructors

Properties

Methods

Constructors

constructor

  • new DB(logger: Logger, storage?: undefined | string): DB
  • Parameters

    • logger: Logger
    • Optional storage: undefined | string

      the file path for the sqlite database file, if ':memory:' or not specified the db is stored in memory

    Returns DB

Properties

Private logger

logger: Logger

models

models: Models

sequelize

sequelize: Sequelize

Private Optional storage

storage: undefined | string

the file path for the sqlite database file, if ':memory:' or not specified the db is stored in memory

Static Private VERSION

VERSION: number = 1

Methods

close

  • close(): Promise<void>

init

  • init(network?: XuNetwork, initDb?: boolean): Promise<void>
  • Initialize the connection to the database.

    Parameters

    • Default value network: XuNetwork = XuNetwork.SimNet
    • Default value initDb: boolean = false

      whether to intialize a new database with default values if no database exists

    Returns Promise<void>

Private isNewDb

  • isNewDb(): Promise<boolean>
  • Checks whether the database is new, in other words whether we are not loading a preexisting database from disk.

    Returns Promise<boolean>

Generated using TypeDoc