database-id-groundhog: HasId/Groundhog interop

[ bsd3, database, library ] [ Propose Tags ]

A class and some instances for HasId/Groundhog interoperation


[Skip to Readme]
Versions [faq] 0.1.0.1
Change log CHANGELOG.md
Dependencies aeson, base (>=4.11 && <4.13), database-id-class, groundhog (<=0.7.0.3), template-haskell [details]
License BSD-3-Clause
Copyright 2019 Obsidian Systems LLC
Author Obsidian Systems LLC
Maintainer maintainer@obsidian.systems
Category Database
Uploaded by abrar at Sun Jul 21 07:34:58 UTC 2019
Distributions NixOS:0.1.0.1
Downloads 45 total (12 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for database-id-groundhog-0.1.0.1

[back to package description]

database-id-groundhog

This package provides support for groundhog database interaction to database-id-class, in particular, the functions

toId :: DefaultKeyId a => DefaultKey a -> Id a
fromId :: DefaultKeyId a => Id a -> DefaultKey a

which convert back and forth between the Id and groundhog's DefaultKey representation according to the instances of the DefaultKeyId class.

It also includes the Template Haskell macro makeDefaultKeyIdInt64 which, given the Name of a datatype and the Name of the data constructor for its groundhog-generated key datatype (typically named the same as the type, with the suffix "Key"), produces an instance of DefaultKeyId in cases where the primary key is an Int64.

Similar to this, makeDefaultKeyIdSimple exists for cases where all that is required to go between DefaultKey a and IdData a is to remove (or put back) Groundhog's type-specific Key data constructor.

It also includes instances of PersistField and PrimitivePersistField for Id a.