Safe Haskell | None |
---|---|
Language | Haskell2010 |
Finally-tagless encoding of SQL92 DDL commands.
If you're writing a beam backend driver and you want to support migrations,
making an instance of your command syntax for IsSql92DdlCommandSyntax
and
making it satisfy Sql92SaneDdlCommandSyntax
.
- type Sql92SaneDdlCommandSyntax cmd = (IsSql92DdlCommandSyntax cmd, Sql92SerializableDataTypeSyntax (Sql92DdlCommandDataTypeSyntax cmd), Sql92SerializableConstraintDefinitionSyntax (Sql92DdlCommandConstraintDefinitionSyntax cmd), Typeable (Sql92DdlCommandColumnSchemaSyntax cmd), Sql92AlterTableColumnSchemaSyntax (Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax cmd)) ~ Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax cmd))
- type Sql92DdlCommandDataTypeSyntax syntax = Sql92ColumnSchemaColumnTypeSyntax (Sql92DdlCommandColumnSchemaSyntax syntax)
- type Sql92DdlCommandColumnSchemaSyntax syntax = Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax syntax)
- type Sql92DdlCommandConstraintDefinitionSyntax syntax = Sql92ColumnSchemaColumnConstraintDefinitionSyntax (Sql92DdlCommandColumnSchemaSyntax syntax)
- type Sql92DdlColumnSchemaConstraintSyntax syntax = Sql92ColumnConstraintDefinitionConstraintSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax syntax)
- type Sql92DdlCommandColumnConstraintSyntax syntax = Sql92DdlColumnSchemaConstraintSyntax (Sql92DdlCommandColumnSchemaSyntax syntax)
- type Sql92DdlCommandMatchTypeSyntax syntax = Sql92ColumnConstraintMatchTypeSyntax (Sql92DdlCommandColumnConstraintSyntax syntax)
- type Sql92DdlCommandReferentialActionSyntax syntax = Sql92ColumnConstraintReferentialActionSyntax (Sql92DdlCommandColumnConstraintSyntax syntax)
- type Sql92DdlCommandConstraintAttributesSyntax syntax = Sql92ColumnConstraintDefinitionAttributesSyntax (Sql92DdlCommandConstraintDefinitionSyntax syntax)
- type Sql92DdlCommandAlterTableActionSyntax syntax = Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax syntax)
- class Sql92DisplaySyntax syntax where
- class (IsSql92CreateTableSyntax (Sql92DdlCommandCreateTableSyntax syntax), IsSql92DropTableSyntax (Sql92DdlCommandDropTableSyntax syntax), IsSql92AlterTableSyntax (Sql92DdlCommandAlterTableSyntax syntax)) => IsSql92DdlCommandSyntax syntax where
- type Sql92DdlCommandCreateTableSyntax syntax :: *
- type Sql92DdlCommandAlterTableSyntax syntax :: *
- type Sql92DdlCommandDropTableSyntax syntax :: *
- class (IsSql92TableConstraintSyntax (Sql92CreateTableTableConstraintSyntax syntax), IsSql92ColumnSchemaSyntax (Sql92CreateTableColumnSchemaSyntax syntax)) => IsSql92CreateTableSyntax syntax where
- type Sql92CreateTableColumnSchemaSyntax syntax :: *
- type Sql92CreateTableTableConstraintSyntax syntax :: *
- type Sql92CreateTableOptionsSyntax syntax :: *
- class IsSql92DropTableSyntax syntax where
- class IsSql92AlterTableActionSyntax (Sql92AlterTableAlterTableActionSyntax syntax) => IsSql92AlterTableSyntax syntax where
- type Sql92AlterTableAlterTableActionSyntax syntax :: *
- class (IsSql92ColumnSchemaSyntax (Sql92AlterTableColumnSchemaSyntax syntax), IsSql92AlterColumnActionSyntax (Sql92AlterTableAlterColumnActionSyntax syntax)) => IsSql92AlterTableActionSyntax syntax where
- type Sql92AlterTableAlterColumnActionSyntax syntax :: *
- type Sql92AlterTableColumnSchemaSyntax syntax :: *
- class IsSql92AlterColumnActionSyntax syntax where
- class (IsSql92ColumnConstraintDefinitionSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92DataTypeSyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Typeable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Eq (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Eq (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92ExpressionSyntax (Sql92ColumnSchemaExpressionSyntax columnSchema), Typeable columnSchema, Sql92DisplaySyntax columnSchema, Eq columnSchema, Hashable columnSchema) => IsSql92ColumnSchemaSyntax columnSchema where
- type Sql92ColumnSchemaColumnTypeSyntax columnSchema :: *
- type Sql92ColumnSchemaExpressionSyntax columnSchema :: *
- type Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema :: *
- class Typeable constraint => IsSql92TableConstraintSyntax constraint where
- class Typeable match => IsSql92MatchTypeSyntax match where
- class Typeable refAction => IsSql92ReferentialActionSyntax refAction where
- class (IsSql92ColumnConstraintSyntax (Sql92ColumnConstraintDefinitionConstraintSyntax constraint), IsSql92ConstraintAttributesSyntax (Sql92ColumnConstraintDefinitionAttributesSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintDefinitionSyntax constraint where
- type Sql92ColumnConstraintDefinitionConstraintSyntax constraint :: *
- type Sql92ColumnConstraintDefinitionAttributesSyntax constraint :: *
- class (Monoid attrs, Typeable attrs) => IsSql92ConstraintAttributesSyntax attrs where
- class (IsSql92MatchTypeSyntax (Sql92ColumnConstraintMatchTypeSyntax constraint), IsSql92ReferentialActionSyntax (Sql92ColumnConstraintReferentialActionSyntax constraint), Typeable (Sql92ColumnConstraintExpressionSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintSyntax constraint where
- type Sql92ColumnConstraintMatchTypeSyntax constraint :: *
- type Sql92ColumnConstraintReferentialActionSyntax constraint :: *
- type Sql92ColumnConstraintExpressionSyntax constraint :: *
- class Sql92SerializableDataTypeSyntax dataType where
- class Sql92SerializableConstraintDefinitionSyntax constraint where
Convenience type synonyms
type Sql92SaneDdlCommandSyntax cmd = (IsSql92DdlCommandSyntax cmd, Sql92SerializableDataTypeSyntax (Sql92DdlCommandDataTypeSyntax cmd), Sql92SerializableConstraintDefinitionSyntax (Sql92DdlCommandConstraintDefinitionSyntax cmd), Typeable (Sql92DdlCommandColumnSchemaSyntax cmd), Sql92AlterTableColumnSchemaSyntax (Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax cmd)) ~ Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax cmd)) Source #
Command syntaxes that can be used to issue DDL commands.
type Sql92DdlCommandDataTypeSyntax syntax = Sql92ColumnSchemaColumnTypeSyntax (Sql92DdlCommandColumnSchemaSyntax syntax) Source #
type Sql92DdlCommandColumnSchemaSyntax syntax = Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax syntax) Source #
type Sql92DdlCommandConstraintDefinitionSyntax syntax = Sql92ColumnSchemaColumnConstraintDefinitionSyntax (Sql92DdlCommandColumnSchemaSyntax syntax) Source #
type Sql92DdlColumnSchemaConstraintSyntax syntax = Sql92ColumnConstraintDefinitionConstraintSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax syntax) Source #
type Sql92DdlCommandColumnConstraintSyntax syntax = Sql92DdlColumnSchemaConstraintSyntax (Sql92DdlCommandColumnSchemaSyntax syntax) Source #
type Sql92DdlCommandMatchTypeSyntax syntax = Sql92ColumnConstraintMatchTypeSyntax (Sql92DdlCommandColumnConstraintSyntax syntax) Source #
type Sql92DdlCommandReferentialActionSyntax syntax = Sql92ColumnConstraintReferentialActionSyntax (Sql92DdlCommandColumnConstraintSyntax syntax) Source #
type Sql92DdlCommandConstraintAttributesSyntax syntax = Sql92ColumnConstraintDefinitionAttributesSyntax (Sql92DdlCommandConstraintDefinitionSyntax syntax) Source #
type Sql92DdlCommandAlterTableActionSyntax syntax = Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax syntax) Source #
class Sql92DisplaySyntax syntax where Source #
Type classes for syntaxes which can be displayed
displaySyntax :: syntax -> String Source #
Render the syntax as a String
, representing the SQL expression it
stands for
class (IsSql92CreateTableSyntax (Sql92DdlCommandCreateTableSyntax syntax), IsSql92DropTableSyntax (Sql92DdlCommandDropTableSyntax syntax), IsSql92AlterTableSyntax (Sql92DdlCommandAlterTableSyntax syntax)) => IsSql92DdlCommandSyntax syntax where Source #
type Sql92DdlCommandCreateTableSyntax syntax :: * Source #
type Sql92DdlCommandAlterTableSyntax syntax :: * Source #
type Sql92DdlCommandDropTableSyntax syntax :: * Source #
createTableCmd :: Sql92DdlCommandCreateTableSyntax syntax -> syntax Source #
dropTableCmd :: Sql92DdlCommandDropTableSyntax syntax -> syntax Source #
alterTableCmd :: Sql92DdlCommandAlterTableSyntax syntax -> syntax Source #
class (IsSql92TableConstraintSyntax (Sql92CreateTableTableConstraintSyntax syntax), IsSql92ColumnSchemaSyntax (Sql92CreateTableColumnSchemaSyntax syntax)) => IsSql92CreateTableSyntax syntax where Source #
type Sql92CreateTableColumnSchemaSyntax syntax :: * Source #
type Sql92CreateTableTableConstraintSyntax syntax :: * Source #
type Sql92CreateTableOptionsSyntax syntax :: * Source #
createTableSyntax :: Maybe (Sql92CreateTableOptionsSyntax syntax) -> Text -> [(Text, Sql92CreateTableColumnSchemaSyntax syntax)] -> [Sql92CreateTableTableConstraintSyntax syntax] -> syntax Source #
class IsSql92DropTableSyntax syntax where Source #
dropTableSyntax :: Text -> syntax Source #
class IsSql92AlterTableActionSyntax (Sql92AlterTableAlterTableActionSyntax syntax) => IsSql92AlterTableSyntax syntax where Source #
type Sql92AlterTableAlterTableActionSyntax syntax :: * Source #
alterTableSyntax :: Text -> Sql92AlterTableAlterTableActionSyntax syntax -> syntax Source #
class (IsSql92ColumnSchemaSyntax (Sql92AlterTableColumnSchemaSyntax syntax), IsSql92AlterColumnActionSyntax (Sql92AlterTableAlterColumnActionSyntax syntax)) => IsSql92AlterTableActionSyntax syntax where Source #
type Sql92AlterTableAlterColumnActionSyntax syntax :: * Source #
type Sql92AlterTableColumnSchemaSyntax syntax :: * Source #
alterColumnSyntax :: Text -> Sql92AlterTableAlterColumnActionSyntax syntax -> syntax Source #
addColumnSyntax :: Text -> Sql92AlterTableColumnSchemaSyntax syntax -> syntax Source #
dropColumnSyntax :: Text -> syntax Source #
renameTableToSyntax :: Text -> syntax Source #
renameColumnToSyntax :: Text -> Text -> syntax Source #
class IsSql92AlterColumnActionSyntax syntax where Source #
setNotNullSyntax :: syntax Source #
setNullSyntax :: syntax Source #
class (IsSql92ColumnConstraintDefinitionSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92DataTypeSyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Typeable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Eq (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Eq (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92ExpressionSyntax (Sql92ColumnSchemaExpressionSyntax columnSchema), Typeable columnSchema, Sql92DisplaySyntax columnSchema, Eq columnSchema, Hashable columnSchema) => IsSql92ColumnSchemaSyntax columnSchema where Source #
type Sql92ColumnSchemaColumnTypeSyntax columnSchema :: * Source #
type Sql92ColumnSchemaExpressionSyntax columnSchema :: * Source #
type Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema :: * Source #
:: Sql92ColumnSchemaColumnTypeSyntax columnSchema | Column type |
-> Maybe (Sql92ColumnSchemaExpressionSyntax columnSchema) | Default value |
-> [Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema] | Column constraints |
-> Maybe Text | Default collation |
-> columnSchema |
class Typeable constraint => IsSql92TableConstraintSyntax constraint where Source #
primaryKeyConstraintSyntax :: [Text] -> constraint Source #
class Typeable match => IsSql92MatchTypeSyntax match where Source #
fullMatchSyntax :: match Source #
partialMatchSyntax :: match Source #
class Typeable refAction => IsSql92ReferentialActionSyntax refAction where Source #
referentialActionCascadeSyntax, referentialActionSetNullSyntax, referentialActionSetDefaultSyntax, referentialActionNoActionSyntax
referentialActionCascadeSyntax :: refAction Source #
referentialActionSetNullSyntax :: refAction Source #
referentialActionSetDefaultSyntax :: refAction Source #
referentialActionNoActionSyntax :: refAction Source #
class (IsSql92ColumnConstraintSyntax (Sql92ColumnConstraintDefinitionConstraintSyntax constraint), IsSql92ConstraintAttributesSyntax (Sql92ColumnConstraintDefinitionAttributesSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintDefinitionSyntax constraint where Source #
type Sql92ColumnConstraintDefinitionConstraintSyntax constraint :: * Source #
type Sql92ColumnConstraintDefinitionAttributesSyntax constraint :: * Source #
constraintDefinitionSyntax :: Maybe Text -> Sql92ColumnConstraintDefinitionConstraintSyntax constraint -> Maybe (Sql92ColumnConstraintDefinitionAttributesSyntax constraint) -> constraint Source #
class (Monoid attrs, Typeable attrs) => IsSql92ConstraintAttributesSyntax attrs where Source #
initiallyDeferredAttributeSyntax, initiallyImmediateAttributeSyntax, notDeferrableAttributeSyntax, deferrableAttributeSyntax
initiallyDeferredAttributeSyntax :: attrs Source #
initiallyImmediateAttributeSyntax :: attrs Source #
notDeferrableAttributeSyntax :: attrs Source #
deferrableAttributeSyntax :: attrs Source #
class (IsSql92MatchTypeSyntax (Sql92ColumnConstraintMatchTypeSyntax constraint), IsSql92ReferentialActionSyntax (Sql92ColumnConstraintReferentialActionSyntax constraint), Typeable (Sql92ColumnConstraintExpressionSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintSyntax constraint where Source #
notNullConstraintSyntax, uniqueColumnConstraintSyntax, primaryKeyColumnConstraintSyntax, checkColumnConstraintSyntax, referencesConstraintSyntax
type Sql92ColumnConstraintMatchTypeSyntax constraint :: * Source #
type Sql92ColumnConstraintReferentialActionSyntax constraint :: * Source #
type Sql92ColumnConstraintExpressionSyntax constraint :: * Source #
notNullConstraintSyntax :: constraint Source #
uniqueColumnConstraintSyntax :: constraint Source #
primaryKeyColumnConstraintSyntax :: constraint Source #
checkColumnConstraintSyntax :: Sql92ColumnConstraintExpressionSyntax constraint -> constraint Source #
referencesConstraintSyntax Source #
:: Text | |
-> [Text] | |
-> Maybe (Sql92ColumnConstraintMatchTypeSyntax constraint) | |
-> Maybe (Sql92ColumnConstraintReferentialActionSyntax constraint) | On update |
-> Maybe (Sql92ColumnConstraintReferentialActionSyntax constraint) | On delete |
-> constraint |
class Sql92SerializableDataTypeSyntax dataType where Source #
IsSql92DataTypeSyntax
es that can be serialized to JSON
serializeDataType :: dataType -> Value Source #
class Sql92SerializableConstraintDefinitionSyntax constraint where Source #
IsSql92ColumnConstraintDefinitionSyntax
es that can be serialized to JSON
serializeConstraint :: constraint -> Value Source #