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

Orville.PostgreSQL.Expr.ColumnDefinition

Description

Since: 1.0.0.0

Synopsis

Documentation

data ColumnDefinition Source #

Represent a complete definition of a column. E.G.

foo INTEGER

ColumnDefinition provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

columnDefinition Source #

Arguments

:: ColumnName

The name the resulting column should have.

-> DataType

The SQL type of the column.

-> Maybe ColumnConstraint

The constraint on the column, if any.

-> Maybe ColumnDefault

The default value for the column, if any.

-> ColumnDefinition 

Smart constructor for ensuring a ColumnDefinition is set up correctly.

Since: 1.0.0.0

data ColumnConstraint Source #

Represent constraints, such as nullability, on a column. E.G.

NOT NULL

ColumnConstraint provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

notNullConstraint :: ColumnConstraint Source #

Express that a column may not contain NULL.

Since: 1.0.0.0

nullConstraint :: ColumnConstraint Source #

Express that a column may contain NULL.

Since: 1.0.0.0

data ColumnDefault Source #

Represents the default value of a column. E.G.

now()

ColumnDefault provides' a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

columnDefault :: ValueExpression -> ColumnDefault Source #

Given a ValueExpression, use that as a ColumnDefault. This is the preferred path to creating a column default. Note that it is up to the caller to ensure the ValueExpression makes sense for the resulting ColumnDefinition this will be a part of.

Since: 1.0.0.0