Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Provider

Hierarchy

Index

Constructors

constructor

  • new Provider(store: Store<Piece>, directory: string, file: keyof string[], options?: PieceOptions): Provider
  • since

    0.0.1

    Parameters

    • store: Store<Piece>

      The store this piece is for

    • directory: string

      The base directory to the pieces folder

    • file: keyof string[]

      The path from the pieces folder to the piece file

    • Optional options: PieceOptions

      The options for this piece

    Returns Provider

Properties

Readonly client

client: Client

The client this Piece was created with.

since

0.0.1

Readonly directory

directory: string

The base directory this Piece is stored in.

since

0.0.1

enabled

enabled: boolean

Whether or not the Piece is enabled.

since

0.0.1

Readonly file

file: keyof string[]

The file location where this Piece is stored.

since

0.0.1

name

name: string

The name of the Piece.

since

0.0.1

Readonly store

store: Store<Piece>

The store this Piece is from.

since

0.0.1

Accessors

path

  • get path(): string
  • The absolute path to this piece

    since

    0.0.1

    Returns string

type

  • get type(): string
  • The type of piece this is

    since

    0.0.1

    Returns string

Methods

addColumn

  • addColumn(_table: string, _entry: SchemaEntry): Promise<unknown>

Abstract create

Abstract createTable

  • createTable(table: string, rows?: keyof [string, string][]): Promise<unknown>
  • Inserts or creates a table in the database.

    Parameters

    • table: string

      The table to check against

    • Optional rows: keyof [string, string][]

      The rows to insert

    Returns Promise<unknown>

Abstract delete

  • delete(table: string, entry: string): Promise<unknown>
  • Removes entries from a table.

    Parameters

    • table: string

      The table to update

    • entry: string

      The ID of the entry to delete

    Returns Promise<unknown>

Abstract deleteTable

  • deleteTable(table: string): Promise<unknown>
  • Deletes or drops a table from the database.

    Parameters

    • table: string

      The table to check against

    Returns Promise<unknown>

disable

  • disable(): this
  • Disables this piece

    since

    0.0.1

    chainable

    Returns this

enable

  • enable(): this
  • Enables this piece

    since

    0.0.1

    chainable

    Returns this

Abstract get

  • get(table: string, entry: string): Promise<unknown | null>
  • Retrieve a single entry from a table.

    Parameters

    • table: string

      The table to query

    • entry: string

      The ID of the entry to retrieve

    Returns Promise<unknown | null>

Abstract getAll

  • getAll(table: string, entries?: keyof string[]): Promise<unknown[]>
  • Retrieve all entries from a table.

    Parameters

    • table: string

      The table to query

    • Optional entries: keyof string[]

      The ids to retrieve from the table

    Returns Promise<unknown[]>

getColumns

  • getColumns(_table: string): Promise<string[]>

Abstract getKeys

  • getKeys(table: string): Promise<string[]>

Abstract has

  • has(table: string, entry: string): Promise<boolean>
  • Check if an entry exists in a table.

    Parameters

    • table: string

      The table to update

    • entry: string

      The entry's ID to check against

    Returns Promise<boolean>

Abstract hasTable

  • hasTable(table: string): Promise<boolean>
  • Checks if a table exists in the database.

    Parameters

    • table: string

      The table to check against

    Returns Promise<boolean>

init

  • init(): unknown
  • The init method to be optionally overwritten in actual pieces

    since

    0.0.1

    Returns unknown

Protected parseUpdateInput

  • Process the input from {@link Settings#update} or {@link Settings#reset} into a plain unknown that can be used for document-based database drivers. If it receives a non-array, it returns the value without further processing.

    Parameters

    Returns Record<PropertyKey, unknown>

reload

  • reload(): Promise<Piece | null>
  • Reloads this piece

    since

    0.0.1

    Returns Promise<Piece | null>

    The newly loaded piece

removeColumn

  • removeColumn(_table: string, _columns: keyof string[]): Promise<unknown>
  • The removeColumn method which inserts/creates a new table to the database.

    since

    0.5.0

    Parameters

    • _table: string
    • _columns: keyof string[]

    Returns Promise<unknown>

Abstract replace

shutdown

  • shutdown(): unknown

toJSON

  • toJSON(): Record<string, unknown>
  • Defines the JSON.stringify behavior of this piece.

    Returns Record<string, unknown>

toString

  • toString(): string
  • Defines toString behavior for pieces

    since

    0.0.1

    Returns string

    This piece name

unload

  • unload(): boolean
  • Unloads this piece

    since

    0.0.1

    Returns boolean

Abstract update

updateColumn

  • updateColumn(_table: string, _entry: SchemaEntry): Promise<unknown>

Generated using TypeDoc