The main class for the immutable database, holds the indexes, data and primary methods.

A majority of data moving around for select statements and the like is indexes, not the actual data.

export
class

  _NanoSQLDB

implements

  {NanoSQLBackend}

### Hierarchy

- _NanoSQLDB

### Implements

- NanoSQLBackend

## Index

### Constructors

- constructor

### Properties

- _databaseID
- _parent
- _queryCache
- _store

### Methods

- _connect
- _deepFreeze
- _exec
- _extend
- _invalidateCache
- _transaction

## Constructors

### constructor

- new _NanoSQLDB(): _NanoSQLDB

- - Defined in db-index.ts:81

  #### Returns _NanoSQLDB

## Properties

### _databaseID

_databaseID: string

- Defined in db-index.ts:38

Unique database hash ID based on the data model.

internal
type

  {string}

memberof

  _NanoSQLDB

### _parent

_parent: NanoSQLInstance

- Defined in db-index.ts:56

The NanoSQL instance this database is attached to.

internal
type

  {NanoSQLInstance}

memberof

  _NanoSQLDB

### _queryCache

_queryCache: object

- Defined in db-index.ts:69

A query hash split up by tables.

internal
type

  {{

          [tableID: number]: {
              [queryHash: number]: Array<DBRow>
          }
      }}

memberof

  _NanoSQLDB

#### Type declaration

- ##### [tableID: number]: object

  - ##### [queryHash: number]: Array<DBRow>

### _store

_store: _NanoSQL_Storage

- Defined in db-index.ts:81

Holds the database data.

type

  {_NanoSQL_Storage}

memberof

  _NanoSQLDB

## Methods

### _connect

- _connect(connectArgs: DBConnect): void

- Implementation of NanoSQLBackend._connect

  - Defined in db-index.ts:97

  Called once to init the database, prep all the needed variables and data models

  memberof

    _NanoSQLDB

  #### Parameters

  - ##### connectArgs: DBConnect

  #### Returns void

### _deepFreeze

- _deepFreeze(obj: any, tableID?: undefined | number): any

- - Defined in db-index.ts:152

  Recursively freezes a js object, used to prevent the rows from being edited once they're added.

  internal
  memberof

    _NanoSQLQuery

  #### Parameters

  - ##### obj: any

  - ##### Optional tableID: undefined | number

  #### Returns any

### _exec

- _exec(execArgs: DBExec): void

- Implementation of NanoSQLBackend._exec

  - Defined in db-index.ts:111

  Called by NanoSQL to execute queries on this database.

  memberof

    _NanoSQLDB

  #### Parameters

  - ##### execArgs: DBExec

  #### Returns void

### _extend

- _extend(db: NanoSQLInstance, command: string): Promise<any>

- - Defined in db-index.ts:215

  Undo & Redo logic.

  ### Undo

  Reverse the state of the database by one step into the past. Usage: `NanoSQL().extend("<")`;

  ### Redo

  Step the database state forward by one. Usage: `NanoSQL().extend(">")`;

  ### Query

  Discover the state of the history system

      NanoSQL().extend("?").then(function(state) {
       console.log(state[0]) // <= length of history records
       console.log(state[1]) // <= current history pointer position
      });

  The history point is zero by default, perforing undo shifts the pointer backward while redo shifts it forward.

  memberof

    _NanoSQLDB

  #### Parameters

  - ##### db: NanoSQLInstance

  - ##### command: string

  #### Returns Promise<any>

### _invalidateCache

- _invalidateCache(changedTableID: number, changedRows: DBRow[], changedRowPKS: any[], type: string, action?: undefined | string): void

- - Defined in db-index.ts:124

  Invalidate the query cache based on the rows being affected

  internal
  memberof

    _NanoSQLDB

  #### Parameters

  - ##### changedTableID: number

  - ##### changedRows: DBRow[]

  - ##### changedRowPKS: any[]

  - ##### type: string

  - ##### Optional action: undefined | string

  #### Returns void

### _transaction

- _transaction(type: "start" | "end", transactionID: number): Promise<any[]>

- Implementation of NanoSQLBackend._transaction

  - Defined in db-index.ts:167

  #### Parameters

  - ##### type: "start" | "end"

  - ##### transactionID: number

  #### Returns Promise<any[]>

Generated using TypeDoc