-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Backend for the persistent library using postgresql. -- -- Based on the postgresql-simple package @package persistent-postgresql @version 2.13.4.0 module Database.Persist.Postgresql.Internal -- | Newtype used to avoid orphan instances for postgresql-simple -- classes. newtype P P :: PersistValue -> P [unP] :: P -> PersistValue -- | Represent Postgres interval using NominalDiffTime newtype PgInterval PgInterval :: NominalDiffTime -> PgInterval [getPgInterval] :: PgInterval -> NominalDiffTime -- | Get the field parser corresponding to the given Oid. -- -- For example, pass in the Oid of bool, and you will get -- back a field parser which parses boolean values in the table into -- PersistBools. getGetter :: Oid -> Getter PersistValue instance GHC.Classes.Ord Database.Persist.Postgresql.Internal.Unknown instance GHC.Read.Read Database.Persist.Postgresql.Internal.Unknown instance GHC.Show.Show Database.Persist.Postgresql.Internal.Unknown instance GHC.Classes.Eq Database.Persist.Postgresql.Internal.Unknown instance GHC.Classes.Ord Database.Persist.Postgresql.Internal.UnknownLiteral instance GHC.Read.Read Database.Persist.Postgresql.Internal.UnknownLiteral instance GHC.Show.Show Database.Persist.Postgresql.Internal.UnknownLiteral instance GHC.Classes.Eq Database.Persist.Postgresql.Internal.UnknownLiteral instance GHC.Show.Show Database.Persist.Postgresql.Internal.PgInterval instance GHC.Classes.Eq Database.Persist.Postgresql.Internal.PgInterval instance Database.PostgreSQL.Simple.ToField.ToField Database.Persist.Postgresql.Internal.PgInterval instance Database.PostgreSQL.Simple.FromField.FromField Database.Persist.Postgresql.Internal.PgInterval instance Database.Persist.Class.PersistField.PersistField Database.Persist.Postgresql.Internal.PgInterval instance Database.Persist.Sql.Class.PersistFieldSql Database.Persist.Postgresql.Internal.PgInterval instance Database.PostgreSQL.Simple.ToField.ToField Database.Persist.Postgresql.Internal.P instance Database.PostgreSQL.Simple.FromField.FromField Database.Persist.Postgresql.Internal.UnknownLiteral instance Database.PostgreSQL.Simple.ToField.ToField Database.Persist.Postgresql.Internal.UnknownLiteral instance Database.PostgreSQL.Simple.FromField.FromField Database.Persist.Postgresql.Internal.Unknown instance Database.PostgreSQL.Simple.ToField.ToField Database.Persist.Postgresql.Internal.Unknown instance Database.PostgreSQL.Simple.FromField.FromField Database.Persist.Postgresql.Internal.P -- | A postgresql backend for persistent. module Database.Persist.Postgresql -- | Create a PostgreSQL connection pool and run the given action. The pool -- is properly released after the action finishes using it. Note that you -- should not use the given ConnectionPool outside the action -- since it may already have been released. The provided action should -- use runSqlConn and *not* runReaderT because the former -- brackets the database action with transaction begin/commit. withPostgresqlPool :: (MonadLoggerIO m, MonadUnliftIO m) => ConnectionString -> Int -> (Pool SqlBackend -> m a) -> m a -- | Same as withPostgresPool, but takes a callback for obtaining -- the server version (to work around an Amazon Redshift bug). withPostgresqlPoolWithVersion :: (MonadUnliftIO m, MonadLoggerIO m) => (Connection -> IO (Maybe Double)) -> ConnectionString -> Int -> (Pool SqlBackend -> m a) -> m a -- | Same as withPostgresqlPool, but instead of opening a pool of -- connections, only one connection is opened. The provided action should -- use runSqlConn and *not* runReaderT because the former -- brackets the database action with transaction begin/commit. withPostgresqlConn :: (MonadUnliftIO m, MonadLoggerIO m) => ConnectionString -> (SqlBackend -> m a) -> m a -- | Same as withPostgresqlConn, but takes a callback for obtaining -- the server version (to work around an Amazon Redshift bug). withPostgresqlConnWithVersion :: (MonadUnliftIO m, MonadLoggerIO m) => (Connection -> IO (Maybe Double)) -> ConnectionString -> (SqlBackend -> m a) -> m a -- | Same as withPostgresqlPool, but can be configured with -- PostgresConf and PostgresConfHooks. withPostgresqlPoolWithConf :: (MonadUnliftIO m, MonadLoggerIO m) => PostgresConf -> PostgresConfHooks -> (Pool SqlBackend -> m a) -> m a -- | Create a PostgreSQL connection pool. Note that it's your -- responsibility to properly close the connection pool when unneeded. -- Use withPostgresqlPool for an automatic resource control. createPostgresqlPool :: (MonadUnliftIO m, MonadLoggerIO m) => ConnectionString -> Int -> m (Pool SqlBackend) -- | Same as createPostgresqlPool, but additionally takes a callback -- function for some connection-specific tweaking to be performed after -- connection creation. This could be used, for example, to change the -- schema. For more information, see: -- -- -- https://groups.google.com/d/msg/yesodweb/qUXrEN_swEo/O0pFwqwQIdcJ createPostgresqlPoolModified :: (MonadUnliftIO m, MonadLoggerIO m) => (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool SqlBackend) -- | Same as other similarly-named functions in this module, but takes -- callbacks for obtaining the server version (to work around an Amazon -- Redshift bug) and connection-specific tweaking (to change the schema). createPostgresqlPoolModifiedWithVersion :: (MonadUnliftIO m, MonadLoggerIO m) => (Connection -> IO (Maybe Double)) -> (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool SqlBackend) -- | Same as createPostgresqlPool, but can be configured with -- PostgresConf and PostgresConfHooks. createPostgresqlPoolWithConf :: (MonadUnliftIO m, MonadLoggerIO m) => PostgresConf -> PostgresConfHooks -> m (Pool SqlBackend) -- | A libpq connection string. A simple example of connection -- string would be "host=localhost port=5432 user=test dbname=test -- password=test". Please read libpq's documentation at -- https://www.postgresql.org/docs/current/static/libpq-connect.html -- for more details on how to create such strings. type ConnectionString = ByteString -- | This type is used to determine how to update rows using Postgres' -- INSERT ... ON CONFLICT KEY UPDATE functionality, exposed via -- upsertWhere and upsertManyWhere in this library. data HandleUpdateCollision record -- | Copy the field directly from the record. copyField :: PersistField typ => EntityField record typ -> HandleUpdateCollision record -- | Copy the field into the database only if the value in the -- corresponding record is non-NULL. -- -- @since 2.12.1.0 copyUnlessNull :: PersistField typ => EntityField record (Maybe typ) -> HandleUpdateCollision record -- | Copy the field into the database only if the value in the -- corresponding record is non-empty, where "empty" means the Monoid -- definition for mempty. Useful for Text, String, -- ByteString, etc. -- -- The resulting HandleUpdateCollision type is useful for the -- upsertManyWhere function. -- -- @since 2.12.1.0 copyUnlessEmpty :: (Monoid typ, PersistField typ) => EntityField record typ -> HandleUpdateCollision record -- | Copy the field into the database only if the field is not equal to the -- provided value. This is useful to avoid copying weird nullary data -- into the database. -- -- The resulting HandleUpdateCollision type is useful for the -- upsertMany function. -- -- @since 2.12.1.0 copyUnlessEq :: PersistField typ => EntityField record typ -> typ -> HandleUpdateCollision record -- | Exclude any record field if it doesn't match the filter record. Used -- only in upsertWhere and upsertManyWhere -- -- TODO: we could probably make a sum type for the Filter record -- that's passed into the upsertWhere and upsertManyWhere -- methods that has similar behavior to the HandleCollisionUpdate type. excludeNotEqualToOriginal :: (PersistField typ, PersistEntity rec) => EntityField rec typ -> Filter rec -- | Information required to connect to a PostgreSQL database using -- persistent's generic facilities. These values are the same -- that are given to withPostgresqlPool. data PostgresConf PostgresConf :: ConnectionString -> Int -> Integer -> Int -> PostgresConf -- | The connection string. [pgConnStr] :: PostgresConf -> ConnectionString -- | How many stripes to divide the pool into. See Data.Pool for -- details. @since 2.11.0.0 [pgPoolStripes] :: PostgresConf -> Int -- | How long connections can remain idle before being disposed of, in -- seconds. @since 2.11.0.0 [pgPoolIdleTimeout] :: PostgresConf -> Integer -- | How many connections should be held in the connection pool. [pgPoolSize] :: PostgresConf -> Int -- | Represent Postgres interval using NominalDiffTime newtype PgInterval PgInterval :: NominalDiffTime -> PgInterval [getPgInterval] :: PgInterval -> NominalDiffTime -- | Postgres specific upsertWhere. This method does the following: -- It will insert a record if no matching unique key exists. If a unique -- key exists, it will update the relevant field with a user-supplied -- value, however, it will only do this update on a user-supplied -- condition. For example, here's how this method could be called like -- such: -- --
-- upsertWhere record [recordField =. newValue] [recordField /= newValue] ---- -- Called thusly, this method will insert a new record (if none exists) -- OR update a recordField with a new value assuming the condition in the -- last block is met. upsertWhere :: (backend ~ PersistEntityBackend record, PersistEntity record, PersistEntityBackend record ~ SqlBackend, MonadIO m, PersistStore backend, BackendCompatible SqlBackend backend, OnlyOneUniqueKey record) => record -> [Update record] -> [Filter record] -> ReaderT backend m () -- | Postgres specific upsertManyWhere. This method does the -- following: It will insert a record if no matching unique key exists. -- If a unique key exists, it will update the relevant field with a -- user-supplied value, however, it will only do this update on a -- user-supplied condition. For example, here's how this method could be -- called like such: -- -- upsertManyWhere [record] [recordField =. newValue] [recordField !=. -- newValue] -- -- Called thusly, this method will insert a new record (if none exists) -- OR update a recordField with a new value assuming the condition in the -- last block is met. upsertManyWhere :: forall record backend m. (backend ~ PersistEntityBackend record, BackendCompatible SqlBackend backend, PersistEntityBackend record ~ SqlBackend, PersistEntity record, OnlyOneUniqueKey record, MonadIO m) => [record] -> [HandleUpdateCollision record] -> [Update record] -> [Filter record] -> ReaderT backend m () -- | Generate a SqlBackend from a Connection. openSimpleConn :: LogFunc -> Connection -> IO SqlBackend -- | Generate a SqlBackend from a Connection, but takes a -- callback for obtaining the server version. openSimpleConnWithVersion :: (Connection -> IO (Maybe Double)) -> LogFunc -> Connection -> IO SqlBackend -- | Access underlying connection, returning Nothing if the -- SqlBackend provided isn't backed by postgresql-simple. getSimpleConn :: BackendCompatible SqlBackend backend => backend -> Maybe Connection -- | Get the SQL string for the table that a PeristEntity represents. -- Useful for raw SQL queries. tableName :: PersistEntity record => record -> Text -- | Get the SQL string for the field that an EntityField represents. -- Useful for raw SQL queries. fieldName :: PersistEntity record => EntityField record typ -> Text -- | Mock a migration even when the database is not present. This function -- performs the same functionality of printMigration with the -- difference that an actual database is not needed. mockMigration :: Migration -> IO () -- | Enable a Postgres extension. See -- https://www.postgresql.org/docs/current/static/contrib.html for -- a list. migrateEnableExtension :: Text -> Migration -- | Hooks for configuring the Persistent/its connection to Postgres data PostgresConfHooks PostgresConfHooks :: (Connection -> IO (NonEmpty Word)) -> (Connection -> IO ()) -> PostgresConfHooks -- | Function to get the version of Postgres -- -- The default implementation queries the server with "show -- server_version". Some variants of Postgres, such as Redshift, don't -- support showing the version. It's recommended you return a hardcoded -- version in those cases. [pgConfHooksGetServerVersion] :: PostgresConfHooks -> Connection -> IO (NonEmpty Word) -- | Action to perform after a connection is created. -- -- Typical uses of this are modifying the connection (e.g. to set the -- schema) or logging a connection being created. -- -- The default implementation does nothing. [pgConfHooksAfterCreate] :: PostgresConfHooks -> Connection -> IO () -- | Default settings for PostgresConfHooks. See the individual -- fields of PostgresConfHooks for the default values. defaultPostgresConfHooks :: PostgresConfHooks -- | Wrapper for persistent SqlBackends that carry the corresponding -- Connection. data RawPostgresql backend RawPostgresql :: backend -> Connection -> RawPostgresql backend -- | The persistent backend [persistentBackend] :: RawPostgresql backend -> backend -- | The underlying Connection [rawPostgresqlConnection] :: RawPostgresql backend -> Connection -- | Create a PostgreSQL connection pool which also exposes the raw -- connection. The raw counterpart to createPostgresqlPool. createRawPostgresqlPool :: (MonadUnliftIO m, MonadLoggerIO m) => ConnectionString -> Int -> m (Pool (RawPostgresql SqlBackend)) -- | The raw counterpart to createPostgresqlPoolModified. createRawPostgresqlPoolModified :: (MonadUnliftIO m, MonadLoggerIO m) => (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool (RawPostgresql SqlBackend)) -- | The raw counterpart to createPostgresqlPoolModifiedWithVersion. createRawPostgresqlPoolModifiedWithVersion :: (MonadUnliftIO m, MonadLoggerIO m) => (Connection -> IO (Maybe Double)) -> (Connection -> IO ()) -> ConnectionString -> Int -> m (Pool (RawPostgresql SqlBackend)) -- | The raw counterpart to createPostgresqlPoolWithConf. createRawPostgresqlPoolWithConf :: (MonadUnliftIO m, MonadLoggerIO m) => PostgresConf -> PostgresConfHooks -> m (Pool (RawPostgresql SqlBackend)) instance Database.Persist.Class.PersistStore.HasPersistBackend b => Database.Persist.Class.PersistStore.HasPersistBackend (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistStore.PersistStoreRead b) => Database.Persist.Class.PersistStore.PersistStoreRead (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistQuery.PersistQueryRead b) => Database.Persist.Class.PersistQuery.PersistQueryRead (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistUnique.PersistUniqueRead b) => Database.Persist.Class.PersistUnique.PersistUniqueRead (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistStore.PersistStoreWrite b) => Database.Persist.Class.PersistStore.PersistStoreWrite (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistQuery.PersistQueryWrite b) => Database.Persist.Class.PersistQuery.PersistQueryWrite (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistUnique.PersistUniqueWrite b) => Database.Persist.Class.PersistUnique.PersistUniqueWrite (Database.Persist.Postgresql.RawPostgresql b) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Show.Show (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Show.Show (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Read.Read (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Read.Read (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Classes.Eq (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Classes.Eq (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Classes.Ord (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Classes.Ord (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Num.Num (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Num.Num (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Real.Integral (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Real.Integral (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistStore.BackendKey b)) => Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistStore.BackendKey b)) => Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Real.Real (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Real.Real (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Enum.Enum (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Enum.Enum (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), GHC.Enum.Bounded (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Enum.Bounded (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistStore.BackendKey b)) => Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b), Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistStore.BackendKey b)) => Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Postgresql.RawPostgresql b)) instance GHC.Show.Show Database.Persist.Postgresql.AlterColumn instance GHC.Show.Show Database.Persist.Postgresql.AlterTable instance GHC.Show.Show Database.Persist.Postgresql.AlterDB instance Data.Data.Data Database.Persist.Postgresql.PostgresConf instance GHC.Read.Read Database.Persist.Postgresql.PostgresConf instance GHC.Show.Show Database.Persist.Postgresql.PostgresConf instance Database.Persist.Class.PersistStore.BackendCompatible (Database.Persist.Postgresql.RawPostgresql b) (Database.Persist.Postgresql.RawPostgresql b) instance Database.Persist.Class.PersistStore.BackendCompatible b (Database.Persist.Postgresql.RawPostgresql b) instance Database.Persist.Class.PersistStore.PersistCore b => Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Postgresql.RawPostgresql b) instance Data.Aeson.Types.FromJSON.FromJSON Database.Persist.Postgresql.PostgresConf instance Database.Persist.Class.PersistConfig.PersistConfig Database.Persist.Postgresql.PostgresConf instance GHC.Show.Show Database.Persist.Postgresql.PostgresServerVersionError instance GHC.Exception.Type.Exception Database.Persist.Postgresql.PostgresServerVersionError -- | Filter operators for JSON values added to PostgreSQL 9.4 module Database.Persist.Postgresql.JSON -- | This operator checks inclusion of the JSON value on the right hand -- side in the JSON value on the left hand side. -- --
-- {} @> {} == True
-- {"a":1,"b":false} @> {} == True
--
--
-- Any key-value will be matched top-level
--
--
-- {"a":1,"b":{"c":true"}} @> {"a":1} == True
-- {"a":1,"b":{"c":true"}} @> {"b":1} == False
-- {"a":1,"b":{"c":true"}} @> {"b":{}} == True
-- {"a":1,"b":{"c":true"}} @> {"c":true} == False
-- {"a":1,"b":{"c":true"}} @> {"b":{c":true}} == True
--
--
-- -- [] @> [] == True -- [1,2,"hi",false,null] @> [] == True ---- -- Any array has to be a sub-set. Any object or array will also be -- compared as being a subset of. -- --
-- [1,2,"hi",false,null] @> [1] == True
-- [1,2,"hi",false,null] @> [null,"hi"] == True
-- [1,2,"hi",false,null] @> ["hi",true] == False
-- [1,2,"hi",false,null] @> ["hi",2,null,false,1] == True
-- [1,2,"hi",false,null] @> [1,2,"hi",false,null,{}] == False
--
--
-- Arrays and objects inside arrays match the same way they'd be matched
-- as being on their own.
--
--
-- [1,"hi",[false,3],{"a":[null]}] @> [{}] == True
-- [1,"hi",[false,3],{"a":[null]}] @> [{"a":[]}] == True
-- [1,"hi",[false,3],{"a":[null]}] @> [{"b":[null]}] == False
-- [1,"hi",[false,3],{"a":[null]}] @> [[]] == True
-- [1,"hi",[false,3],{"a":[null]}] @> [[3]] == True
-- [1,"hi",[false,3],{"a":[null]}] @> [[true,3]] == False
--
--
-- A regular value has to be a member
--
-- -- [1,2,"hi",false,null] @> 1 == True -- [1,2,"hi",false,null] @> 5 == False -- [1,2,"hi",false,null] @> "hi" == True -- [1,2,"hi",false,null] @> false == True -- [1,2,"hi",false,null] @> "2" == False ---- -- An object will never match with an array -- --
-- [1,2,"hi",[false,3],{"a":null}] @> {} == False
-- [1,2,"hi",[false,3],{"a":null}] @> {"a":null} == False
--
--
--
-- "hello" @> "hello" == True
-- "hello" @> "Hello" == False
-- "hello" @> "h" == False
-- "hello" @> {"hello":1} == False
-- "hello" @> ["hello"] == False
--
-- 5 @> 5 == True
-- 5 @> 5.00 == True
-- 5 @> 1 == False
-- 5 @> 7 == False
-- 12345 @> 1234 == False
-- 12345 @> 2345 == False
-- 12345 @> "12345" == False
-- 12345 @> [1,2,3,4,5] == False
--
-- true @> true == True
-- true @> false == False
-- false @> true == False
-- true @> "true" == False
--
-- null @> null == True
-- null @> 23 == False
-- null @> "null" == False
-- null @> {} == False
--
(@>.) :: EntityField record Value -> Value -> Filter record
infix 4 @>.
-- | Same as @>. except the inclusion check is reversed. i.e. is
-- the JSON value on the left hand side included in the JSON value of the
-- right hand side.
(<@.) :: EntityField record Value -> Value -> Filter record
infix 4 <@.
-- | This operator takes a column and a string to find a top-level
-- key/field in an object.
--
-- -- column ?. string ---- -- N.B. This operator might have some unexpected interactions with -- non-object values. Please reference the examples. -- --
-- {"a":null} ? "a" == True
-- {"test":false,"a":500} ? "a" == True
-- {"b":{"a":[]}} ? "a" == False
-- {} ? "a" == False
-- {} ? "{}" == False
-- {} ? "" == False
-- {"":9001} ? "" == True
--
--
--
-- ["a"] ? "a" == True
-- [["a"]] ? "a" == False
-- [9,false,"1",null] ? "1" == True
-- [] ? "[]" == False
-- [{"a":true}] ? "a" == False
--
--
-- -- "a" ? "a" == True -- "1" ? "1" == True -- "ab" ? "a" == False -- 1 ? "1" == False -- null ? "null" == False -- true ? "true" == False -- 1.5 ? "1.5" == False --(?.) :: EntityField record Value -> Text -> Filter record infix 4 ?. -- | This operator takes a column and a list of strings to test whether ANY -- of the elements of the list are top level fields in an object. -- --
-- column ?|. list ---- -- N.B. An empty list will never match anything. Also, this -- operator might have some unexpected interactions with -- non-object values. Please reference the examples. -- --
-- {"a":null} ?| ["a","b","c"] == True
-- {"test":false,"a":500} ?| ["a","b","c"] == True
-- {} ?| ["a","{}"] == False
-- {"b":{"a":[]}} ?| ["a","c"] == False
-- {"b":{"a":[]},"test":null} ?| [] == False
--
--
--
-- ["a"] ?| ["a","b","c"] == True
-- [["a"]] ?| ["a","b","c"] == False
-- [9,false,"1",null] ?| ["a","false"] == False
-- [] ?| ["a","b","c"] == False
-- [] ?| [] == False
-- [{"a":true}] ?| ["a","b","c"] == False
-- [null,4,"b",[]] ?| ["a","b","c"] == True
--
--
-- -- "a" ?| ["a","b","c"] == True -- "1" ?| ["a","b","1"] == True -- "ab" ?| ["a","b","c"] == False -- 1 ?| ["a","1"] == False -- null ?| ["a","null"] == False -- true ?| ["a","true"] == False -- "a" ?| [] == False --(?|.) :: EntityField record Value -> [Text] -> Filter record infix 4 ?|. -- | This operator takes a column and a list of strings to test whether ALL -- of the elements of the list are top level fields in an object. -- --
-- column ?&. list ---- -- N.B. An empty list will match anything. Also, this -- operator might have some unexpected interactions with -- non-object values. Please reference the examples. -- --
-- {"a":null} ?& ["a"] == True
-- {"a":null} ?& ["a","a"] == True
-- {"test":false,"a":500} ?& ["a"] == True
-- {"test":false,"a":500} ?& ["a","b"] == False
-- {} ?& ["{}"] == False
-- {"b":{"a":[]}} ?& ["a"] == False
-- {"b":{"a":[]},"c":false} ?& ["a","c"] == False
-- {"a":1,"b":2,"c":3,"d":4} ?& ["b","d"] == True
-- {} ?& [] == True
-- {"b":{"a":[]},"test":null} ?& [] == True
--
--
--
-- ["a"] ?& ["a"] == True
-- ["a"] ?& ["a","a"] == True
-- [["a"]] ?& ["a"] == False
-- ["a","b","c"] ?& ["a","b","d"] == False
-- [9,"false","1",null] ?& ["1","false"] == True
-- [] ?& ["a","b"] == False
-- [{"a":true}] ?& ["a"] == False
-- ["a","b","c","d"] ?& ["b","c","d"] == True
-- [null,4,{"test":false}] ?& [] == True
-- [] ?& [] == True
--
--
-- -- "a" ?& ["a"] == True -- "1" ?& ["a","1"] == False -- "b" ?& ["b","b"] == True -- "ab" ?& ["a","b"] == False -- 1 ?& ["1"] == False -- null ?& ["null"] == False -- true ?& ["true"] == False -- 31337 ?& [] == True -- true ?& [] == True -- null ?& [] == True --(?&.) :: EntityField record Value -> [Text] -> Filter record infix 4 ?&. -- | A JSON value represented as a Haskell value. data Value instance Database.Persist.Class.PersistField.PersistField a => Database.Persist.Class.PersistField.PersistField (Database.Persist.Postgresql.JSON.PostgresArray a) instance Database.Persist.Class.PersistField.PersistField Data.Aeson.Types.Internal.Value instance Database.Persist.Sql.Class.PersistFieldSql Data.Aeson.Types.Internal.Value