homepage: https://github.com/higherkindness/mu-haskell/persistent#readme
changelog-type: ''
hash: 0b855321c9e37b2a26aa59a750b837cfe3aeee79a799c4038ea7cad02d2247cf
test-bench-deps: {}
maintainer: flavio.corpa@47deg.com
synopsis: Utilities for interoperation between Mu and Persistent
changelog: ''
basic-deps:
  mu-schema: -any
  base: ! '>=4.7 && <5'
  persistent: -any
  monad-logger: -any
  transformers: -any
  resourcet: -any
all-versions:
- 0.1.0.0
author: Flavio Corpa, Alejandro Serrano
latest: 0.1.0.0
description-type: markdown
description: "# mu-persistent\n\nThis are some utilities to integrate easily with
  `persistent` while using Mu.\n\n## Usage\n\nSay you have for example, the following
  `Entity`:\n\n```haskell\nmkPersist sqlSettings [persistLowerCase|\nPerson\n  name
  T.Text\n  age  Int32\n  deriving Show Generic\n|]\n```\n\nBut in your `proto3`,
  the `Person` message is defined as:\n\n```protobuf\nmessage PersonRequest {\n  int64
  identifier = 1;\n}\n\nmessage Person {\n  PersonRequest pid = 1;\n  string name
  = 2;\n  int32 age = 3;\n}\n```\n\nHow can you derive the correct `ToSchema` instances
  that `Mu` needs to work with that nested `Id` that belongs to another message? \U0001F914\n\nYou
  can use `WithEntityNestedId`, along with a custom field mapping and `DerivingVia`
  to do all the work for you!\n\n```haskell\n{-# language DerivingVia #-}\n\ntype
  PersonFieldMapping\n  = '[ \"personAge\" ':-> \"age\", \"personName\" ':-> \"name\"
  ]\n\nderiving via (WithEntityNestedId \"Person\" PersonFieldMapping (Entity Person))\n
  \ instance ToSchema Maybe PersistentSchema \"Person\" (Entity Person)\n```\n\nFor
  a more complete example of usage, please check [the example with `persistent`](https://github.com/higherkindness/mu-haskell/blob/master/examples/with-persistent/src/Schema.hs).\n"
license-name: Apache-2.0

Update from Hackage at 2020-01-13T10:21:16Z
Update from Hackage at 2020-01-13T10:21:16Z
