persistent-relational-record-0.1.1.0: relational-record on persisten backends.

Copyright(C) 2016 Takahiro Himura
LicenseBSD3
MaintainerTakahiro Himura <taka@himura.jp>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Database.Persist.Relational

Description

This module works as a bridge between Haskell Relational Record and Persistent. It uses the persistent entities definition instead of obtaining schema from DB at compilation time.

See: https://github.com/himura/persistent-relational-record#readme

Synopsis

Documentation

runQuery Source #

Arguments

:: (MonadResource m, MonadReader env m, HasPersistBackend env, BaseBackend env ~ SqlBackend, ToSql PersistValue p, ToPersistEntity a b) 
=> Query p a

Query to get record type a requires parameter p

-> p

Parameter type

-> Source m b 

Execute a HRR Query and return the stream of its results.

mkHrrInstances :: [EntityDef] -> Q [Dec] Source #

Generate instances for haskell-relational-record.

defineTableFromPersistent Source #

Arguments

:: Name

Name of the persistent record type corresponds to the table

-> [EntityDef]

EntityDef which is generated by persistent

-> Q [Dec] 

Generate all templates about table from persistent table definition using default naming rule.

defineTableFromPersistentWithConfig Source #

Arguments

:: Config

Configration for haskell relational record

-> String

Database schema name

-> Name

Name of the persistent record type corresponds to the table

-> [EntityDef]

EntityDef which is generated by persistent

-> Q [Dec] 

Generate all templates about table from persistent table definition.

defaultConfig :: Config #

Default configuration.

class ToPersistEntity a b | a -> b, b -> a where Source #

Minimal complete definition

recordFromSql'