Copyright | (c) James M.C. Haver II |
---|---|
License | BSD3 |
Maintainer | mchaver@gmail.com |
Stability | Beta |
Safe Haskell | Safe |
Language | Haskell2010 |
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.
data ModelsFilePiece Source #
Top level pieces of a Persistent Model file.
A single Persist Model Entity.
Entity | |
|
data EntityChild Source #
All of the child elements of a Persist Model Entity. | They are all indented in the Model File.
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.
EntityField | |
|
data Strictness Source #
Table rows can be strict or lazy
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 |
data EntityFieldType Source #
An entity data row's type.
EntityFieldType | |
|
data EntityUnique Source #
A unique idenfitier for an Entity: UniqueUserName userIdent
,
UniqueNameAndAge name age
.
EntityUnique | |
|
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.
EntityDerive | |
|
data EntityPrimary Source #
'Primary name'
data EntityForeign Source #
'Foreign Tree fkparent parent'
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.
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.
data EntityFieldLastItem Source #
These items may occur at the very end of a Field's line and in any order.
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 # | |