Copyright | (c) James M.C. Haver II |
---|---|
License | BSD3 |
Maintainer | mchaver@gmail.com |
Stability | Beta |
Safe Haskell | Safe |
Language | Haskell2010 |
Database.Persist.Syntax.Types
Description
Attempt to represent all possible Persistent data in a syntax tree.
https://github.com/yesodweb/persistent/wiki/Persistent-entity-syntax contains relatively up to date information about Persistent syntax.
https://github.com/yesodweb/persistent/tree/master/persistent-test/src gives clues about newer syntax elements that have not been added to the wiki.
It is recommended that you import this qualified.
import qualified Database.Persist.Syntax.Types as PST
- type ModelsFile = [ModelsFilePiece]
- data ModelsFilePiece
- data Entity = Entity {}
- data EntityChild
- data EntityField = EntityField {}
- data Strictness
- = Strict
- | ExplicitStrict
- | Lazy
- data EntityFieldType = EntityFieldType {}
- data EntityUnique = EntityUnique {}
- data EntityDerive = EntityDerive {
- entityDeriveTypes :: [Text]
- data EntityPrimary = EntityPrimary {
- entityPrimaryType :: [Text]
- data EntityForeign = EntityForeign {}
- data WhiteSpace = WhiteSpace {
- whiteSpace :: Text
- data Comment = Comment {}
- data MigrationOnlyAndSafeToRemoveOption
- data EntityFieldLastItem
Documentation
type ModelsFile = [ModelsFilePiece] Source #
The root of the Persistent syntax tree. A collection of data types with which you can recontruct a Persist Model file or create an altered version.
A single Persist Model Entity.
Constructors
Entity | |
Fields
|
data EntityChild Source #
All of the child elements of a Persist Model Entity. | They are all indented in the Model File.
Constructors
Instances
data EntityField Source #
An EntityField corresponds to a column in SQL or a key-value pair in MongoDB. The minimal definition of an EntityField in Persistent has a name and a type.
Constructors
EntityField | |
Fields
|
Instances
data Strictness Source #
Table rows can be strict or lazy
Constructors
Strict | Persist Model types are strict without any notation |
ExplicitStrict | "!" can be used to reemphasize that a type is strict |
Lazy | "~" means that a type is Lazy |
Instances
data EntityFieldType Source #
An entity data row's type.
Constructors
EntityFieldType | |
Fields
|
Instances
data EntityUnique Source #
A unique idenfitier for an Entity: UniqueUserName userIdent
,
UniqueNameAndAge name age
.
Constructors
EntityUnique | |
Fields
|
Instances
data EntityDerive Source #
deriving Eq
, deriving Show
, etc.
There may be custom generic typeclasses
so there is no restriction on what the type might be
, other than it starts with a capital letter.
Constructors
EntityDerive | |
Fields
|
Instances
data EntityPrimary Source #
'Primary name'
Constructors
EntityPrimary | |
Fields
|
Instances
data EntityForeign Source #
'Foreign Tree fkparent parent'
Constructors
EntityForeign | |
Fields
|
Instances
data WhiteSpace Source #
White space found in the Persistent file or QuasiQuoter. Need to save the white space in case you want to reproduce the original file or an altered version of the file from the Persist Syntax Tree.
Constructors
WhiteSpace | |
Fields
|
Instances
Haskell style comments that start with --
in Persistent.
data MigrationOnlyAndSafeToRemoveOption Source #
MigrationOnly
persistent-template >= 1.2.0 marks a field that is ignored
by normal processing but retained for migration purposes. Useful for
implementing columns that other tools may need but Persistent does not.
SafeToRemove
is used to deprecate a field after MigrationOnly
has been
used. The field will be removed from the database if it is present. This is
a destructive change which is marked as safe by the user.
Constructors
MigrationOnly | |
SafeToRemove |
data EntityFieldLastItem Source #
These items may occur at the very end of a Field's line and in any order.
Constructors
FieldDefault Text | |
FieldSqlRow Text | |
FieldSqlType Text | |
FieldMaxLen Int |
Instances
Eq EntityFieldLastItem Source # | Define equality to match based only on the type constructor. |
Read EntityFieldLastItem Source # | |
Show EntityFieldLastItem Source # | |
Generic EntityFieldLastItem Source # | |
type Rep EntityFieldLastItem Source # | |