Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CoreProvider

Hierarchy

Index

Constructors

constructor

Properties

Private Readonly baseDirectory

baseDirectory: string

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>

create

  • create(table: string, id: string, data?: unknown): Promise<void>
  • Insert a new document into a directory.

    Parameters

    • table: string

      The name of the directory

    • id: string

      The document name

    • Default value data: unknown = {}

      The unknown with all properties you want to insert into the document

    Returns Promise<void>

createTable

  • createTable(table: string): Promise<void>

delete

  • delete(table: string, id: string): Promise<void>
  • Delete a document from the table.

    Parameters

    • table: string

      The name of the directory

    • id: string

      The document name

    Returns Promise<void>

deleteTable

  • deleteTable(table: string): Promise<void>

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

get

  • get(table: string, id: string): Promise<unknown | null>
  • Get a document from a directory.

    Parameters

    • table: string

      The name of the directory

    • id: string

      The document name

    Returns Promise<unknown | null>

getAll

  • getAll(table: string, entries: string[]): Promise<unknown[]>
  • Get all documents from a directory.

    Parameters

    • table: string

      The name of the directory to fetch from

    • entries: string[]

      The entries to download, defaults to all keys in the directory

    Returns Promise<unknown[]>

getColumns

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

getKeys

  • getKeys(table: string): Promise<string[]>
  • Get all document names from a directory, filter by json.

    Parameters

    • table: string

      The name of the directory to fetch from

    Returns Promise<string[]>

getRandom

  • getRandom(table: string): Promise<unknown | null>
  • Get a random document from a directory.

    Parameters

    • table: string

      The name of the directory

    Returns Promise<unknown | null>

has

  • has(table: string, id: string): Promise<boolean>
  • Check if the document exists.

    Parameters

    • table: string

      The name of the directory

    • id: string

      The document name

    Returns Promise<boolean>

hasTable

  • hasTable(table: string): Promise<boolean>

init

  • init(): Promise<void>

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>

replace

  • replace(table: string, id: string, data: unknown): Promise<void>
  • Replace all the data from a document.

    Parameters

    • table: string

      The name of the directory

    • id: string

      The document name

    • data: unknown

      The new data for the document

    Returns Promise<void>

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

update

  • update(table: string, id: string, data: unknown): Promise<void>
  • Update a document from a directory.

    Parameters

    • table: string

      The name of the directory

    • id: string

      The document name

    • data: unknown

      The unknown with all the properties you want to update

    Returns Promise<void>

updateColumn

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

Generated using TypeDoc