-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Utilities for interoperation between Mu and Persistent -- -- Please see the readme file. @package mu-persistent @version 0.3.0.0 -- | The persistent library, and in particular its quasi-quoters -- for entities, generate data types which do not look exactly as plain -- records. This module defines some wrappers which modify the -- ToSchema and FromSchema derivation to work with them. module Mu.Adapter.Persistent -- | Wrapper for Entity to be used with DerivingVia. This -- wrappers indicates that the identifier is to be found as the sole -- field of another object, like in: -- --
-- { id: { key: 3 }, name: "Somebody" }
--
newtype WithEntityNestedId (ty :: Symbol) (fmap :: Mappings Symbol Symbol) a
WithEntityNestedId :: a -> WithEntityNestedId (ty :: Symbol) (fmap :: Mappings Symbol Symbol) a
[unWithEntityNestedId] :: WithEntityNestedId (ty :: Symbol) (fmap :: Mappings Symbol Symbol) a -> a
-- | Wrapper for Entity to be used with DerivingVia. This
-- wrappers indicates that the identifier is to be found in the schema at
-- the same level as other fields, like in:
--
--
-- { id: 3, name: "Somebody" }
--
newtype WithEntityPlainId (ty :: Symbol) (fmap :: Mappings Symbol Symbol) a
WithEntityPlainId :: a -> WithEntityPlainId (ty :: Symbol) (fmap :: Mappings Symbol Symbol) a
[unWithEntityPlainId] :: WithEntityPlainId (ty :: Symbol) (fmap :: Mappings Symbol Symbol) a -> a
-- | Simple utility to execute a database operation in any monad which
-- supports IO operations. Note that all logging messages are
-- discarded.
runDb :: MonadIO m => SqlBackend -> ReaderT SqlBackend (NoLoggingT (ResourceT IO)) a -> m a
instance (GHC.Generics.Generic t, (sch Mu.Schema.Definition.:/: sty) GHC.Types.~ 'Mu.Schema.Definition.DRecord name (nestedIdArg : args), nestedIdArg GHC.Types.~ 'Mu.Schema.Definition.FieldDef fname k, Mu.Adapter.Persistent.ToSchemaKey sch idTy k, (sch Mu.Schema.Definition.:/: idTy) GHC.Types.~ 'Mu.Schema.Definition.DRecord idName '[idArg], idArg GHC.Types.~ 'Mu.Schema.Definition.FieldDef idArgName ('Mu.Schema.Definition.TPrimitive GHC.Int.Int64), GHC.Generics.Rep t GHC.Types.~ GHC.Generics.D1 dInfo (GHC.Generics.C1 cInfo f), Mu.Schema.Class.GToSchemaRecord sch fmap args f, Database.Persist.Class.PersistStore.ToBackendKey (Database.Persist.Class.PersistEntity.PersistEntityBackend t) t, Database.Persist.Class.PersistEntity.PersistEntityBackend t GHC.Types.~ Database.Persist.Sql.Types.Internal.SqlBackend) => Mu.Schema.Class.ToSchema sch sty (Mu.Adapter.Persistent.WithEntityNestedId sty fmap (Database.Persist.Class.PersistEntity.Entity t))
instance Mu.Adapter.Persistent.ToSchemaKey sch idTy ('Mu.Schema.Definition.TSchematic idTy)
instance Mu.Adapter.Persistent.ToSchemaKey sch idTy t => Mu.Adapter.Persistent.ToSchemaKey sch idTy ('Mu.Schema.Definition.TOption t)
instance (GHC.Generics.Generic t, (sch Mu.Schema.Definition.:/: sty) GHC.Types.~ 'Mu.Schema.Definition.DRecord name (idArg : args), idArg GHC.Types.~ 'Mu.Schema.Definition.FieldDef idArgName ('Mu.Schema.Definition.TPrimitive GHC.Int.Int64), GHC.Generics.Rep t GHC.Types.~ GHC.Generics.D1 dInfo (GHC.Generics.C1 cInfo f), Mu.Schema.Class.GToSchemaRecord sch fmap args f, Database.Persist.Class.PersistStore.ToBackendKey (Database.Persist.Class.PersistEntity.PersistEntityBackend t) t, Database.Persist.Class.PersistEntity.PersistEntityBackend t GHC.Types.~ Database.Persist.Sql.Types.Internal.SqlBackend) => Mu.Schema.Class.ToSchema sch sty (Mu.Adapter.Persistent.WithEntityPlainId sty fmap (Database.Persist.Class.PersistEntity.Entity t))