| Copyright | Flipstone Technology Partners 2023 |
|---|---|
| License | MIT |
| Stability | Stable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Orville.PostgreSQL.Expr.SequenceDefinition
Description
Since: 1.0.0.0
Synopsis
- data CreateSequenceExpr
- createSequenceExpr :: Qualified SequenceName -> Maybe IncrementByExpr -> Maybe MinValueExpr -> Maybe MaxValueExpr -> Maybe StartWithExpr -> Maybe CacheExpr -> Maybe CycleExpr -> CreateSequenceExpr
- data AlterSequenceExpr
- alterSequenceExpr :: Qualified SequenceName -> Maybe IncrementByExpr -> Maybe MinValueExpr -> Maybe MaxValueExpr -> Maybe StartWithExpr -> Maybe CacheExpr -> Maybe CycleExpr -> AlterSequenceExpr
- data IncrementByExpr
- incrementBy :: Int64 -> IncrementByExpr
- data MinValueExpr
- minValue :: Int64 -> MinValueExpr
- noMinValue :: MinValueExpr
- data MaxValueExpr
- maxValue :: Int64 -> MaxValueExpr
- noMaxValue :: MaxValueExpr
- data StartWithExpr
- startWith :: Int64 -> StartWithExpr
- data CacheExpr
- cache :: Int64 -> CacheExpr
- data CycleExpr
- cycle :: CycleExpr
- noCycle :: CycleExpr
- cycleIfTrue :: Bool -> CycleExpr
- data DropSequenceExpr
- dropSequenceExpr :: Maybe IfExists -> Qualified SequenceName -> DropSequenceExpr
- nextVal :: Qualified SequenceName -> ValueExpression
- nextValFunction :: FunctionName
- currVal :: Qualified SequenceName -> ValueExpression
- currValFunction :: FunctionName
- setVal :: Qualified SequenceName -> Int64 -> ValueExpression
- setValFunction :: FunctionName
Documentation
data CreateSequenceExpr Source #
Type to represent a CREATE SEQUENCE statement. E.G.
CREATE SEQUENCE foo INCREMENT 2
CreateSequenceExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression CreateSequenceExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: CreateSequenceExpr -> RawSql Source # | |
Arguments
| :: Qualified SequenceName | The name to be used for the sequence. |
| -> Maybe IncrementByExpr | An optional |
| -> Maybe MinValueExpr | An optional |
| -> Maybe MaxValueExpr | An optional |
| -> Maybe StartWithExpr | An optional |
| -> Maybe CacheExpr | An optional |
| -> Maybe CycleExpr | An optional |
| -> CreateSequenceExpr |
Constructs a CreateSequenceExpr with the given sequence options.
Since: 1.0.0.0
data AlterSequenceExpr Source #
Type to represent a CREATE SEQUENCE statement. E.G.
ALTER SEQUENCE foo START WITH 0
AlterSequenceExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression AlterSequenceExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: AlterSequenceExpr -> RawSql Source # | |
Arguments
| :: Qualified SequenceName | The name of the sequence to alter |
| -> Maybe IncrementByExpr | An optional |
| -> Maybe MinValueExpr | An optional |
| -> Maybe MaxValueExpr | An optional |
| -> Maybe StartWithExpr | An optional |
| -> Maybe CacheExpr | An optional |
| -> Maybe CycleExpr | An optional |
| -> AlterSequenceExpr |
Constructs an AlterSequenceExpr with the given sequence options.
Since: 1.0.0.0
data IncrementByExpr Source #
Type to represent an INCREMENT BY expression for sequences. E.G.
INCREMENT BY 0
IncrementByExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression IncrementByExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: IncrementByExpr -> RawSql Source # | |
incrementBy :: Int64 -> IncrementByExpr Source #
Constructs an IncrementByExpr that will make the sequence increment by
the given value.
Since: 1.0.0.0
data MinValueExpr Source #
Type to represent a MINVALUE expression for sequences. E.G.
MINVALUE 0
MinValueExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression MinValueExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: MinValueExpr -> RawSql Source # | |
minValue :: Int64 -> MinValueExpr Source #
Constructs a MinValueExpr which gives the sequence the specified minimum
value.
Since: 1.0.0.0
noMinValue :: MinValueExpr Source #
Constructs a MinValueExpr which gives the sequence no minimum value (i.e.
NO MINVALUE).
Since: 1.0.0.0
data MaxValueExpr Source #
Type to represent a MAXVALUE expression for sequences. E.G.
MAXVALUE 1000000
MaxValueExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression MaxValueExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: MaxValueExpr -> RawSql Source # | |
maxValue :: Int64 -> MaxValueExpr Source #
Constructs a MaxValueExpr which gives the sequence the specified maximum
value.
Since: 1.0.0.0
noMaxValue :: MaxValueExpr Source #
Constructs a MaxValueExpr which gives the sequence no maximum value (i.e.
NO MAXVALUE).
Since: 1.0.0.0
data StartWithExpr Source #
Type to represent a START WITH expression for sequences. E.G.
START WITH 1
StartWithExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression StartWithExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: StartWithExpr -> RawSql Source # | |
startWith :: Int64 -> StartWithExpr Source #
Constructs a StartWithExpr which gives the sequence the specified start
value.
Since: 1.0.0.0
Type to represent a CACHE expression for sequences. E.G.
CACHE 16
CacheExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
cache :: Int64 -> CacheExpr Source #
Constructs a CacheExpr that will make the sequence pre-allocate the
specified number of sequence values.
Since: 1.0.0.0
Type to represent a CYCLE expression for sequences. E.G.
CYCLE
or
NO CYCLE
CycleExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
Constructs a CycleExpr that indicates that the sequence should cycle.
Since: 1.0.0.0
Constructs a CycleExpr that indicates that the sequence should not cycle.
Since: 1.0.0.0
cycleIfTrue :: Bool -> CycleExpr Source #
Constructs a CycleExpr that will cause the sequence to cycle if the flag
passed is True.
Since: 1.0.0.0
data DropSequenceExpr Source #
Type to represent a DROP SEQUENCE statement. E.G.
DROP SEQUENCE foo
DropSequenceExpr provides a SqlExpression instance. See
unsafeSqlExpression for how to construct a value with your own custom
SQL.
Since: 1.0.0.0
Instances
| SqlExpression DropSequenceExpr Source # | |
Defined in Orville.PostgreSQL.Expr.SequenceDefinition Methods toRawSql :: DropSequenceExpr -> RawSql Source # | |
dropSequenceExpr :: Maybe IfExists -> Qualified SequenceName -> DropSequenceExpr Source #
Constructs a DropSequenceExpr that will drop sequence with the given name.
You may specify an IfExists argument if you want to include an IF EXISTS
condition in the statement.
Since: 1.0.0.0
nextVal :: Qualified SequenceName -> ValueExpression Source #
Constructs a ValueExpression that will use the nextval PostgreSQL
function to get the next value from the given sequence. If you're trying to
construct your own SELECT to get the value of the sequence, you can use the
constructed ValueExpression with deriveColumnAs
to build the item to select.
Since: 1.0.0.0
nextValFunction :: FunctionName Source #
The nextval PostgreSQL function.
Since: 1.0.0.0
currVal :: Qualified SequenceName -> ValueExpression Source #
Constructs a ValueExpression that will use the currval PostgreSQL
function to get the current value from the given sequence. If you're trying to
construct your own SELECT to get the value of the sequence, you can use the
constructed ValueExpression with deriveColumnAs
to build the item to select.
Since: 1.0.0.0
currValFunction :: FunctionName Source #
The currval PostgreSQL function.
Since: 1.0.0.0
setVal :: Qualified SequenceName -> Int64 -> ValueExpression Source #
Constructs a ValueExpression that will use the setval PostgreSQL function
to set the value from the given sequence. If you're trying to construct your
own SELECT to set the value of the sequence, you can use the constructed
ValueExpression with deriveColumnAs to build the
item to select.
Since: 1.0.0.0
setValFunction :: FunctionName Source #
The setval PostgreSQL function.
Since: 1.0.0.0