Skip to content

db/sequence

Documentation

Overview

Classes

Sequence

nextval()

Retrieves the next available value from a specified sequence.

ts
static nextval(sequence: string, tableName: string, datasourceName: string): number;
ParameterTypeDescription
sequencestringThe name of the database sequence.
tableNamestringOptional: The name of the table associated with the sequence (depends on database dialect/facade implementation).
datasourceNamestringOptional: The name of the database connection to use.

Returns

  • Type: number
  • Description: The next sequence value as a number.

create()

Creates a new database sequence.

ts
static create(sequence: string, start: number, datasourceName: string): void;
ParameterTypeDescription
sequencestringThe name of the sequence to create.
startnumberOptional: The starting value for the sequence (defaults to 1 if not provided).
datasourceNamestringOptional: The name of the database connection to use.

Returns

  • Type: void
  • Description:

drop()

Drops (deletes) an existing database sequence.

ts
static drop(sequence: string, datasourceName: string): void;
ParameterTypeDescription
sequencestringThe name of the sequence to drop.
datasourceNamestringOptional: The name of the database connection to use.

Returns

  • Type: void
  • Description: