persistent-parser-0.1.0.2: Parse persistent model files

Copyright(c) James M.C. Haver II
LicenseBSD3
Maintainermchaver@gmail.com
StabilityBeta
Safe HaskellSafe
LanguageHaskell2010

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

Synopsis

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.

data Entity Source #

A single Persist Model Entity.

Constructors

Entity 

Fields

Instances

Eq Entity Source # 

Methods

(==) :: Entity -> Entity -> Bool #

(/=) :: Entity -> Entity -> Bool #

Read Entity Source # 
Show Entity Source # 
Generic Entity Source # 

Associated Types

type Rep Entity :: * -> * #

Methods

from :: Entity -> Rep Entity x #

to :: Rep Entity x -> Entity #

type Rep Entity Source # 
type Rep Entity = D1 (MetaData "Entity" "Database.Persist.Syntax.Types" "persistent-parser-0.1.0.2-80zSDov4xwfKh3Z4iyDm5U" False) (C1 (MetaCons "Entity" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "entityName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "entityDeriveJson") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) ((:*:) (S1 (MetaSel (Just Symbol "entitySqlTable") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "entityChildren") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [EntityChild])))))

data EntityChild Source #

All of the child elements of a Persist Model Entity. | They are all indented in the Model File.

Instances

Eq EntityChild Source # 
Read EntityChild Source # 
Show EntityChild Source # 
Generic EntityChild Source # 

Associated Types

type Rep EntityChild :: * -> * #

type Rep EntityChild Source # 

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

Eq EntityField Source # 
Read EntityField Source # 
Show EntityField Source # 
Generic EntityField Source # 

Associated Types

type Rep EntityField :: * -> * #

type Rep EntityField Source # 

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

Eq Strictness Source # 
Read Strictness Source # 
Show Strictness Source # 
Generic Strictness Source # 

Associated Types

type Rep Strictness :: * -> * #

type Rep Strictness Source # 
type Rep Strictness = D1 (MetaData "Strictness" "Database.Persist.Syntax.Types" "persistent-parser-0.1.0.2-80zSDov4xwfKh3Z4iyDm5U" False) ((:+:) (C1 (MetaCons "Strict" PrefixI False) U1) ((:+:) (C1 (MetaCons "ExplicitStrict" PrefixI False) U1) (C1 (MetaCons "Lazy" PrefixI False) U1)))

data EntityFieldType Source #

An entity data row's type.

Constructors

EntityFieldType 

Fields

data EntityUnique Source #

A unique idenfitier for an Entity: UniqueUserName userIdent, UniqueNameAndAge name age.

Constructors

EntityUnique 

Fields

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

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

Eq WhiteSpace Source # 
Read WhiteSpace Source # 
Show WhiteSpace Source # 
Generic WhiteSpace Source # 

Associated Types

type Rep WhiteSpace :: * -> * #

type Rep WhiteSpace Source # 
type Rep WhiteSpace = D1 (MetaData "WhiteSpace" "Database.Persist.Syntax.Types" "persistent-parser-0.1.0.2-80zSDov4xwfKh3Z4iyDm5U" False) (C1 (MetaCons "WhiteSpace" PrefixI True) (S1 (MetaSel (Just Symbol "whiteSpace") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Comment Source #

Haskell style comments that start with -- in Persistent.

Constructors

Comment 

Fields

Instances

Eq Comment Source # 

Methods

(==) :: Comment -> Comment -> Bool #

(/=) :: Comment -> Comment -> Bool #

Read Comment Source # 
Show Comment Source # 
Generic Comment Source # 

Associated Types

type Rep Comment :: * -> * #

Methods

from :: Comment -> Rep Comment x #

to :: Rep Comment x -> Comment #

type Rep Comment Source # 
type Rep Comment = D1 (MetaData "Comment" "Database.Persist.Syntax.Types" "persistent-parser-0.1.0.2-80zSDov4xwfKh3Z4iyDm5U" False) (C1 (MetaCons "Comment" PrefixI True) (S1 (MetaSel (Just Symbol "comment") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

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.

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 #