Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Since: 1.0.0.0
Synopsis
- data SequenceDefinition
- mkSequenceDefinition :: String -> SequenceDefinition
- setSequenceSchema :: String -> SequenceDefinition -> SequenceDefinition
- sequenceIdentifier :: SequenceDefinition -> SequenceIdentifier
- sequenceName :: SequenceDefinition -> Qualified SequenceName
- sequenceIncrement :: SequenceDefinition -> Int64
- setSequenceIncrement :: Int64 -> SequenceDefinition -> SequenceDefinition
- sequenceMinValue :: SequenceDefinition -> Int64
- setSequenceMinValue :: Int64 -> SequenceDefinition -> SequenceDefinition
- sequenceMaxValue :: SequenceDefinition -> Int64
- setSequenceMaxValue :: Int64 -> SequenceDefinition -> SequenceDefinition
- sequenceStart :: SequenceDefinition -> Int64
- setSequenceStart :: Int64 -> SequenceDefinition -> SequenceDefinition
- sequenceCache :: SequenceDefinition -> Int64
- setSequenceCache :: Int64 -> SequenceDefinition -> SequenceDefinition
- sequenceCycle :: SequenceDefinition -> Bool
- setSequenceCycle :: Bool -> SequenceDefinition -> SequenceDefinition
- mkCreateSequenceExpr :: SequenceDefinition -> CreateSequenceExpr
Documentation
data SequenceDefinition Source #
Contains the definition of a SQL sequence for Orville to use when creating
the sequence and fetching values from it. You can create a
SequenceDefinition
with default values via mkSequenceDefinition
and then
use the various set functions that are provided if you need to set specific
attributes on the sequence.
Since: 1.0.0.0
Instances
Show SequenceDefinition Source # | |
Defined in Orville.PostgreSQL.Schema.SequenceDefinition showsPrec :: Int -> SequenceDefinition -> ShowS # show :: SequenceDefinition -> String # showList :: [SequenceDefinition] -> ShowS # | |
Eq SequenceDefinition Source # | |
Defined in Orville.PostgreSQL.Schema.SequenceDefinition (==) :: SequenceDefinition -> SequenceDefinition -> Bool # (/=) :: SequenceDefinition -> SequenceDefinition -> Bool # |
mkSequenceDefinition :: String -> SequenceDefinition Source #
Constructs an ascending SequenceDefinition
with increment 1 and cache
1 that does not cycle. The sequence will start at 1 and count to the
largest Int64
value.
Since: 1.0.0.0
setSequenceSchema :: String -> SequenceDefinition -> SequenceDefinition Source #
Sets the sequence's schema to the name in the given String
, which will be
treated as a SQL identifier. If a sequence has a schema name set, it will be
included as a qualifier on the sequence name for all queries involving the
sequence.
Since: 1.0.0.0
sequenceIdentifier :: SequenceDefinition -> SequenceIdentifier Source #
Retrieves the SequenceIdentifier
for this sequence, which is set by the
name provided to mkSequenceDefinition
and any calls made to
setSequenceSchema
thereafter.
Since: 1.0.0.0
sequenceName :: SequenceDefinition -> Qualified SequenceName Source #
Retrieves the Qualified
SequenceName
for the sequence that
should be used to build SQL expressions involving it.
Since: 1.0.0.0
sequenceIncrement :: SequenceDefinition -> Int64 Source #
Retrieves the increment value for the sequence.
Since: 1.0.0.0
setSequenceIncrement :: Int64 -> SequenceDefinition -> SequenceDefinition Source #
Sets the increment value for the sequence. The increment cannot be set to
0
(PostgreSQL will raise an error when trying to create or modify the
sequence in this case).
If the increment is negative, the sequence will be descending. When no explicit start is set, a descending sequence begins at the max value.
Since: 1.0.0.0
setSequenceMinValue :: Int64 -> SequenceDefinition -> SequenceDefinition Source #
Sets the min value for the sequence.
Since: 1.0.0.0
setSequenceMaxValue :: Int64 -> SequenceDefinition -> SequenceDefinition Source #
Sets the max value for the sequence.
Since: 1.0.0.0
sequenceStart :: SequenceDefinition -> Int64 Source #
Retrieves the start value for the sequence. If no explicit start value has
been set, this returns sequenceMinValue
for ascending sequences and
sequenceMaxValue
for descending sequences.
Since: 1.0.0.0
setSequenceStart :: Int64 -> SequenceDefinition -> SequenceDefinition Source #
Sets the sequence start value. The start value must be at least the minimum value and no greater than the maximum value.
Since: 1.0.0.0
sequenceCache :: SequenceDefinition -> Int64 Source #
Retrieves the number of sequence values that will be pre-allocated by PostgreSQL.
Since: 1.0.0.0
setSequenceCache :: Int64 -> SequenceDefinition -> SequenceDefinition Source #
Sets the number of sequence values that will be pre-allocated by PostgreSQL.
Since: 1.0.0.0
sequenceCycle :: SequenceDefinition -> Bool Source #
Indicates whether the sequence will wrap around when it reaches the maximum
value (for ascending sequences) or minimum value (for descending sequences).
When False
, any attempts to get the next value of the sequence while at the
limit will result in an error.
Since: 1.0.0.0
setSequenceCycle :: Bool -> SequenceDefinition -> SequenceDefinition Source #
Sets the sequenceCycle
value for the sequence. True
indicates that the
sequence will cycle. False
will cause an error to be raised if the next
sequence value is requested while already at the limit.
Since: 1.0.0.0
mkCreateSequenceExpr :: SequenceDefinition -> CreateSequenceExpr Source #
Builds a CreateSequenceExpr
that will create a SQL sequence matching
the given SequenceDefinition
when it is executed.
Since: 1.0.0.0