elm-export-persistent-1.0.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

Instances details
Generic (Ent field a) Source # 
Instance details

Defined in Elm.Export.Persist.Ent

Associated Types

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

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 # 
Instance details

Defined in Elm.Export.Persist.Ent

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 # 
Instance details

Defined in Elm.Export.Persist.Ent

Methods

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

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

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

Defined in Elm.Export.Persist.Ent

Methods

toElmType :: Ent field a -> ElmDatatype #

type Rep (Ent field a) Source # 
Instance details

Defined in Elm.Export.Persist.Ent

type Rep (Ent field a) = D1 ('MetaData "Ent" "Elm.Export.Persist.Ent" "elm-export-persistent-1.0.0-inplace" 'True) (C1 ('MetaCons "Ent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe 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 }"