Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SQLProvider

Hierarchy

Index

Constructors

constructor

  • new SQLProvider(store: Store<Piece>, directory: string, file: keyof string[], options?: PieceOptions): SQLProvider
  • 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 SQLProvider

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

Abstract qb

The QueryBuilder instance for this SQL provider

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

Abstract addColumn

  • addColumn(table: string, entry: SchemaEntry): Promise<unknown>

Abstract create

  • create(table: string, entry: string, data: unknown): Promise<unknown>

Abstract createTable

  • createTable(table: string, rows?: keyof [string, string][]): Promise<unknown>

Abstract delete

  • delete(table: string, entry: string): Promise<unknown>

Abstract deleteTable

  • deleteTable(table: string): 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>

Abstract getAll

  • getAll(table: string, entries?: keyof string[]): Promise<unknown[]>

Abstract getColumns

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

Abstract getKeys

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

Abstract has

  • has(table: string, entry: string): Promise<boolean>

Abstract hasTable

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

init

  • init(): Promise<void>

Protected parseTupleUpdateInput

  • Process the input from {@link Settings#update} or {@link Settings#reset} into an unknown with the keys and values that can be used for schema-based (SQL) database drivers. If it receives a non-array, it is flattened into a dotted unknown notation. Please note that this behaviour may be tricky when working with a SchemaEntry which type accepts an unknown and it's not an array, as it'll be flattened into as many keys as properties it has.

    Parameters

    Returns SqlProviderParsedTupleUpdateInput

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

Abstract 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

      The table to check against

    • columns: keyof string[]

      The column names to remove

    Returns Promise<unknown>

Abstract replace

  • replace(table: string, entry: string, data: unknown): Promise<unknown>
  • Overwrites the data from an entry in a table.

    Parameters

    • table: string

      The table to update

    • entry: string

      The entry's ID to update

    • data: unknown

      The new data for the entry

    Returns Promise<unknown>

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

  • update(table: string, entry: string, data: unknown): Promise<unknown>

Abstract updateColumn

  • updateColumn(table: string, entry: SchemaEntry): Promise<unknown>

Generated using TypeDoc