elm-export-persistent-0.2.0: elm-export persistent entities

Copyright(C) 2016-17 William Casarin
LicenseMIT
MaintainerWilliam Casarin <bill@casarin.me>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Elm.Export.Persist.Ent

Description

 

Synopsis

Documentation

newtype Ent (field :: Symbol) a Source #

Entity wrapper that adds ToJSON, FromJSON, and ElmType instances

The first type parameter field is a symbol used for the key name

>>> toElmTypeSource (Proxy :: Proxy (Ent "userId" User))
"type alias User = { userName : String, userId : Int }"

Constructors

Ent (Entity a) 

Instances

Generic (Ent field a) Source # 

Associated Types

type Rep (Ent field a) :: * -> * #

Methods

from :: Ent field a -> Rep (Ent field a) x #

to :: Rep (Ent field a) x -> Ent field a #

(KnownSymbol field, ToJSON a, ToJSON (Key a)) => ToJSON (Ent field a) Source # 

Methods

toJSON :: Ent field a -> Value #

toEncoding :: Ent field a -> Encoding #

toJSONList :: [Ent field a] -> Value #

toEncodingList :: [Ent field a] -> Encoding #

(ToBackendKey SqlBackend a, PersistEntity a, KnownSymbol field, FromJSON a) => FromJSON (Ent field a) Source # 

Methods

parseJSON :: Value -> Parser (Ent field a) #

parseJSONList :: Value -> Parser [Ent field a] #

(KnownSymbol field, ElmType a) => ElmType (Ent field a) Source # 

Methods

toElmType :: Ent field a -> ElmDatatype

type Rep (Ent field a) Source # 
type Rep (Ent field a) = D1 * (MetaData "Ent" "Elm.Export.Persist.Ent" "elm-export-persistent-0.2.0-A3Kj1pgNKv022t5XI0NZP5" True) (C1 * (MetaCons "Ent" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Entity a))))

type EntId a = Ent "id" a Source #

Ent alias, using "id" as the key

>>> toElmTypeSource (Proxy :: Proxy (EntId User))
"type alias User = { userName : String, id : Int }"