Sequence ⇐ Entity

Kind: global class
Extends: Entity

new Sequence(spec)

A database sequence.

Param Type Description
spec Object An {@linkcode Entity} specification representing a sequence object:
spec.db Object A {@linkcode Database}.
spec.name String The sequence's name.
spec.schema String The name of the schema owning the sequence.

sequence.lastValue() ⇒ Promise

Get the last value the sequence returned.

Kind: instance method of Sequence
Returns: Promise - The last sequence value.

sequence.nextValue() ⇒ Promise

Increment the sequence counter and return the next value.

Kind: instance method of Sequence
Returns: Promise - The next sequence value.

sequence.reset([initialValue]) ⇒ Promise

Reset the sequence.

Kind: instance method of Sequence
Returns: Promise - Nothing.

Param Type Description
[initialValue] Number The new value with which to seed the sequence (default 1).