# Sequence

class Sequence(val name: String, val startWith: Long? = null, val incrementBy: Long? = null, val minValue: Long? = null, val maxValue: Long? = null, val cycle: Boolean? = null, val cache: Long? = null)

Represents a database sequence.

#### Parameters

name

Name of the sequence.

startWith

Beginning of the sequence.

incrementBy

Value to be added to the current sequence value when creating a new value.

minValue

Minimum value a sequence can generate.

maxValue

Maximum value for the sequence.

cycle

Allows the sequence to wrap around when the maxValue or minValue has been reached by an ascending or descending sequence respectively.

cache

Specifies how many sequence numbers are to be pre-allocated and stored in memory for faster access.

## Constructors

Sequence
Link copied to clipboard
constructor(name: String, startWith: Long? = null, incrementBy: Long? = null, minValue: Long? = null, maxValue: Long? = null, cycle: Boolean? = null, cache: Long? = null)

## Properties

cache
Link copied to clipboard
val cache: Long? = null
cycle
Link copied to clipboard
val cycle: Boolean? = null
ddl
Link copied to clipboard
val ddl: List<String>

The SQL statements that create this sequence.

identifier
Link copied to clipboard
val identifier: String

This name of this sequence in proper database casing.

incrementBy
Link copied to clipboard
val incrementBy: Long? = null
maxValue
Link copied to clipboard
val maxValue: Long? = null
minValue
Link copied to clipboard
val minValue: Long? = null
name
Link copied to clipboard
val name: String
startWith
Link copied to clipboard
val startWith: Long? = null

## Functions

createStatement
Link copied to clipboard
fun createStatement(): List<String>

Returns the SQL statements that create this sequence.

dropStatement
Link copied to clipboard
fun dropStatement(): List<String>

Returns the SQL statements that drop this sequence.

exists
Link copied to clipboard
fun exists(): Boolean

Returns whether this sequence exists in the database.

nextIntVal
Link copied to clipboard
fun Sequence.nextIntVal(): NextVal<Int>

Advances this sequence and returns the new value.

nextLongVal
Link copied to clipboard
fun Sequence.nextLongVal(): NextVal<Long>

Advances this sequence and returns the new value.