Safe Haskell | None |
---|---|
Language | Haskell98 |
- module Database.Persist.Class
- module Database.Persist.Types
- (=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
- (+=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
- (-=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
- (*=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
- (/=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
- (==.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (!=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (<.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (>.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (<=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (>=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
- (<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v
- (/<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v
- (||.) :: forall v. [Filter v] -> [Filter v] -> [Filter v]
- listToJSON :: [PersistValue] -> Text
- mapToJSON :: [(Text, PersistValue)] -> Text
- toJsonText :: ToJSON j => j -> Text
- getPersistMap :: PersistValue -> Either Text [(Text, PersistValue)]
- limitOffsetOrder :: PersistEntity val => [SelectOpt val] -> (Int, Int, [SelectOpt val])
Documentation
module Database.Persist.Class
module Database.Persist.Types
query combinators
(=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v infixr 3 Source
assign a field a value
(+=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v infixr 3 Source
assign a field by addition (+=)
(-=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v infixr 3 Source
assign a field by subtraction (-=)
(*=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v infixr 3 Source
assign a field by multiplication (*=)
(/=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v infixr 3 Source
assign a field by division (/=)
(==.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v infix 4 Source
(!=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v infix 4 Source
(<.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v infix 4 Source
(>.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v infix 4 Source
(<=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v infix 4 Source
(>=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v infix 4 Source
(<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v infix 4 Source
In
(/<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v infix 4 Source
NotIn
(||.) :: forall v. [Filter v] -> [Filter v] -> [Filter v] infixl 3 Source
the OR of two lists of filters. For example: selectList([PersonAge >. 25, PersonAge 30] ||. [PersonIncome. 15000, PersonIncome <. 25000]) [] will filter records where a person's age is between (25 and 30) OR a person's income is between (15,000 and 25000). If you are looking for an &&. operator to do (A AND B AND (C OR D)) you can use the ++ operator instead as there is no &&. For example: selectList([PersonAge >. 25, PersonAge <. 30] ++ ([PersonCategory ==. 1] ||. [PersonCategory ==. 5])) [] will filter records where a person's age is between (25 and 30) AND (person's category is either 1 or 5)
JSON Utilities
listToJSON :: [PersistValue] -> Text Source
mapToJSON :: [(Text, PersistValue)] -> Text Source
toJsonText :: ToJSON j => j -> Text Source
getPersistMap :: PersistValue -> Either Text [(Text, PersistValue)] Source
Other utililities
limitOffsetOrder :: PersistEntity val => [SelectOpt val] -> (Int, Int, [SelectOpt val]) Source