Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains an intermediate representation of values before the backends serialize them into explicit database types.
Since: 2.13.0.0
Synopsis
-
data
PersistValue
where
- PersistText Text
- PersistByteString ByteString
- PersistInt64 Int64
- PersistDouble Double
- PersistRational Rational
- PersistBool Bool
- PersistDay Day
- PersistTimeOfDay TimeOfDay
- PersistUTCTime UTCTime
- PersistNull
- PersistList [ PersistValue ]
- PersistMap [( Text , PersistValue )]
- PersistObjectId ByteString
- PersistArray [ PersistValue ]
- PersistLiteral_ LiteralType ByteString
- pattern PersistLiteral :: ByteString -> PersistValue
- pattern PersistLiteralEscaped :: ByteString -> PersistValue
- pattern PersistDbSpecific :: ByteString -> PersistValue
- fromPersistValueText :: PersistValue -> Either Text Text
-
data
LiteralType
- = Escaped
- | Unescaped
- | DbSpecific
Documentation
data PersistValue Source #
A raw value which can be stored in any backend and can be marshalled to
and from a
PersistField
.
PersistText Text | |
PersistByteString ByteString | |
PersistInt64 Int64 | |
PersistDouble Double | |
PersistRational Rational | |
PersistBool Bool | |
PersistDay Day | |
PersistTimeOfDay TimeOfDay | |
PersistUTCTime UTCTime | |
PersistNull | |
PersistList [ PersistValue ] | |
PersistMap [( Text , PersistValue )] | |
PersistObjectId ByteString |
Intended especially for MongoDB backend |
PersistArray [ PersistValue ] |
Intended especially for PostgreSQL backend for text arrays |
PersistLiteral_ LiteralType ByteString |
This constructor is used to specify some raw literal value for the
backend. The
Since: 2.12.0.0 |
pattern PersistLiteral :: ByteString -> PersistValue |
This pattern synonym used to be a data constructor on
Since: 2.12.0.0 |
pattern PersistLiteralEscaped :: ByteString -> PersistValue |
This pattern synonym used to be a data constructor on
Since: 2.12.0.0 |
pattern PersistDbSpecific :: ByteString -> PersistValue |
Deprecated: Deprecated since 2.11 because of inconsistent escaping behavior across backends. The Postgres backend escapes these values, while the MySQL backend does not. If you are using this, please switch to
This pattern synonym used to be a data constructor for the
If you use this, it will overlap a patern match on the 'PersistLiteral_,
Since: 2.12.0.0 |
Instances
data LiteralType Source #
A type that determines how a backend should handle the literal.
Since: 2.12.0.0
Escaped |
The accompanying value will be escaped before inserting into the database. This is the correct default choice to use. Since: 2.12.0.0 |
Unescaped |
The accompanying value will not be escaped when inserting into the database. This is potentially dangerous - use this with care. Since: 2.12.0.0 |
DbSpecific |
The
Since: 2.12.0.0 |
Instances
Eq LiteralType Source # | |
Defined in Database.Persist.PersistValue (==) :: LiteralType -> LiteralType -> Bool Source # (/=) :: LiteralType -> LiteralType -> Bool Source # |
|
Ord LiteralType Source # | |
Defined in Database.Persist.PersistValue compare :: LiteralType -> LiteralType -> Ordering Source # (<) :: LiteralType -> LiteralType -> Bool Source # (<=) :: LiteralType -> LiteralType -> Bool Source # (>) :: LiteralType -> LiteralType -> Bool Source # (>=) :: LiteralType -> LiteralType -> Bool Source # max :: LiteralType -> LiteralType -> LiteralType Source # min :: LiteralType -> LiteralType -> LiteralType Source # |
|
Read LiteralType Source # | |
Defined in Database.Persist.PersistValue readsPrec :: Int -> ReadS LiteralType Source # readList :: ReadS [ LiteralType ] Source # readPrec :: ReadPrec LiteralType Source # readListPrec :: ReadPrec [ LiteralType ] Source # |
|
Show LiteralType Source # | |
Defined in Database.Persist.PersistValue |