Copyright | (c) 2011 MailRank Inc. (c) 2011-2012 Leon P Smith |
---|---|
License | BSD3 |
Maintainer | Leon P Smith <leon@melding-monads.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The ToField
typeclass, for rendering a parameter to a SQL query.
Documentation
How to render an element when substituting it into a query.
Plain Builder | Render without escaping or quoting. Use for non-text types
such as numbers, when you are certain that they will not
introduce formatting vulnerabilities via use of characters such
as spaces or " |
Escape ByteString | Escape and enclose in quotes before substituting. Use for all text-like types, and anything else that may contain unsafe characters when rendered. |
EscapeByteA ByteString | Escape binary data for use as a |
EscapeIdentifier ByteString | Escape before substituting. Use for all sql identifiers like
table, column names, etc. This is used by the |
Many [Action] | Concatenate a series of rendering actions. |
class ToField a where Source #
A type that may be used as a single parameter to a SQL query.
Instances
toJSONField :: ToJSON a => a -> Action Source #
Convert a Haskell value to JSON using toEncoding
.
This can be used as the default implementation for the toField
method for Haskell types that have a JSON representation in
PostgreSQL.