database-id-groundhog: HasId/Groundhog interop

[ bsd3, database, library ] [ Propose Tags ] [ Report a vulnerability ]

A class and some instances for HasId/Groundhog interoperation


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 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 2019-07-21T07:34:58Z
Distributions
Downloads 568 total (1 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

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.