HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepersistent-2.14.6.3Haskell2010

Database.Persist.PersistValue

This module contains an intermediate representation of values before the backends serialize them into explicit database types.

  • 2 types
  • 1 value
datadata PersistValue
#

A raw value which can be stored in any backend and can be marshalled to and from a PersistField.

Constructors

Instances12Eq, Ord, Read, Show, NFData, FromJSON, …
patternpattern 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 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.

datadata LiteralType
#

A type that determines how a backend should handle the literal.

Constructors

  • Escaped

    The accompanying value will be escaped before inserting into the database. This is the correct default choice to use.

  • Unescaped

    The accompanying value will not be escaped when inserting into the database. This is potentially dangerous - use this with care.

  • DbSpecific

    The DbSpecific constructor corresponds to the legacy PersistDbSpecific constructor. We need to keep this around because old databases may have serialized JSON representations that reference this. We don't want to break the ability of a database to load rows.

Instances4Eq, Ord, Read, Show
  • Eq LiteralTypeDefined in persistent-2.14.6.3 · Database.Persist.PersistValue
  • Ord LiteralTypeDefined in persistent-2.14.6.3 · Database.Persist.PersistValue
  • Read LiteralTypeDefined in persistent-2.14.6.3 · Database.Persist.PersistValue
  • Show LiteralTypeDefined in persistent-2.14.6.3 · Database.Persist.PersistValue