@hackage / database-id-class

Class for types with a database id

Latest0.1.0.1

About

Metadata

  • Last updated , by abrar
  • License BSD-3-Clause
  • Categories Databases
  • Maintained by: maintainer@obsidian.systems

  • Lottery factor: 0

Links

Installation

Readme

database-id-class

This package defines a (parametric) data type Id a used to refer to the primary key of values of type a in a database.

newtype Id a = Id { unId :: IdData a }

Here, IdData is a type family associated with the HasId class:

class HasId a where
  type IdData a :: *
  type IdData a = Int64

It defaults to Int64 because that tends to be the type you want for tables with an autoincrement primary key.