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 LiteralType
- data PersistValue
- = 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 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
Documentation
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 # (/=) :: LiteralType -> LiteralType -> Bool # | |
Ord LiteralType Source # | |
Defined in Database.Persist.PersistValue compare :: LiteralType -> LiteralType -> Ordering # (<) :: LiteralType -> LiteralType -> Bool # (<=) :: LiteralType -> LiteralType -> Bool # (>) :: LiteralType -> LiteralType -> Bool # (>=) :: LiteralType -> LiteralType -> Bool # max :: LiteralType -> LiteralType -> LiteralType # min :: LiteralType -> LiteralType -> LiteralType # | |
Read LiteralType Source # | |
Defined in Database.Persist.PersistValue readsPrec :: Int -> ReadS LiteralType # readList :: ReadS [LiteralType] # readPrec :: ReadPrec LiteralType # readListPrec :: ReadPrec [LiteralType] # | |
Show LiteralType Source # | |
Defined in Database.Persist.PersistValue showsPrec :: Int -> LiteralType -> ShowS # show :: LiteralType -> String # showList :: [LiteralType] -> ShowS # |
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 |
Instances
pattern PersistLiteral :: ByteString -> PersistValue Source #
This pattern synonym used to be a data constructor on PersistValue
,
but was changed into a catch-all pattern synonym to allow backwards
compatiblity with database types. See the documentation on
PersistDbSpecific
for more details.
Since: 2.12.0.0
pattern PersistLiteralEscaped :: ByteString -> PersistValue Source #
This pattern synonym used to be a data constructor on PersistValue
,
but was changed into a catch-all pattern synonym to allow backwards
compatiblity with database types. See the documentation on
PersistDbSpecific
for more details.
Since: 2.12.0.0
pattern PersistDbSpecific :: ByteString -> PersistValue Source #
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 PersistLiteral_
and provide a relevant LiteralType
for your conversion.
This pattern synonym used to be a data constructor for the
PersistValue
type. It was changed to be a pattern so that JSON-encoded
database values could be parsed into their corresponding values. You
should not use this, and instead prefer to pattern match on
PersistLiteral_
directly.
If you use this, it will overlap a patern match on the 'PersistLiteral_,
PersistLiteral
, and PersistLiteralEscaped
patterns. If you need to
disambiguate between these constructors, pattern match on
PersistLiteral_
directly.
Since: 2.12.0.0
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 |