orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Expr.SequenceDefinition

Description

Since: 1.0.0.0

Synopsis

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

createSequenceExpr Source #

Arguments

:: Qualified SequenceName

The name to be used for the sequence.

-> Maybe IncrementByExpr

An optional INCREMENT expression.

-> Maybe MinValueExpr

An optional MINVALUE expression.

-> Maybe MaxValueExpr

An optional MAXVALUE expression.

-> Maybe StartWithExpr

An optional START WITH expression.

-> Maybe CacheExpr

An optional CACHE expression.

-> Maybe CycleExpr

An optional CYCLE expression.

-> 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

alterSequenceExpr Source #

Arguments

:: Qualified SequenceName

The name of the sequence to alter

-> Maybe IncrementByExpr

An optional INCREMENT expression

-> Maybe MinValueExpr

An optional MINVALUE expression

-> Maybe MaxValueExpr

An optional MAXVALUE expression

-> Maybe StartWithExpr

An optional START WITH expression

-> Maybe CacheExpr

An optional CACHE expression

-> Maybe CycleExpr

An optional CYCLE expression

-> 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

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

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

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

startWith :: Int64 -> StartWithExpr Source #

Constructs a StartWithExpr which gives the sequence the specified start value.

Since: 1.0.0.0

data CacheExpr Source #

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

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

data CycleExpr Source #

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

cycle :: CycleExpr Source #

Constructs a CycleExpr that indicates that the sequence should cycle.

Since: 1.0.0.0

noCycle :: CycleExpr Source #

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

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