graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.SQL.BackendMap

Synopsis

Documentation

newtype BackendMap (i :: BackendType -> Type) Source #

A BackendMap is a data structure that can contain at most one value of an i per BackendType The i type must be one that is parameterized by a BackendType-kinded type parameter

Constructors

BackendMap (Map BackendType (AnyBackend i)) 

Instances

Instances details
SatisfiesForAllBackends i Eq => Eq (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Methods

(==) :: BackendMap i -> BackendMap i -> Bool #

(/=) :: BackendMap i -> BackendMap i -> Bool #

SatisfiesForAllBackends i Show => Show (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Generic (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Associated Types

type Rep (BackendMap i) :: Type -> Type #

Methods

from :: BackendMap i -> Rep (BackendMap i) x #

to :: Rep (BackendMap i) x -> BackendMap i #

Semigroup (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Monoid (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

SatisfiesForAllBackends i FromJSON => FromJSON (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Methods

parseJSON :: Value -> Parser (BackendMap i)

parseJSONList :: Value -> Parser [BackendMap i]

SatisfiesForAllBackends i ToJSON => ToJSON (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Methods

toJSON :: BackendMap i -> Value

toEncoding :: BackendMap i -> Encoding

toJSONList :: [BackendMap i] -> Value

toEncodingList :: [BackendMap i] -> Encoding

type Rep (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

type Rep (BackendMap i) = D1 ('MetaData "BackendMap" "Hasura.SQL.BackendMap" "graphql-engine-1.0.0-inplace" 'True) (C1 ('MetaCons "BackendMap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map BackendType (AnyBackend i)))))

singleton :: forall b i. HasTag b => i b -> BackendMap i Source #

lookup :: forall (b :: BackendType) i. HasTag b => BackendMap i -> Maybe (i b) Source #

Get a value from the map for the particular BackendType b. This function is usually used with a type application. lookup ('Postgres 'Vanilla) backendMap @

elems :: forall i. BackendMap i -> [AnyBackend i] Source #

Get all values in the map

modify :: forall b i. (HasTag b, Monoid (i b)) => (i b -> i b) -> BackendMap i -> BackendMap i Source #

The expression modify f bmap alters the value x at b. modify is a restricted version of alter which cannot delete entries and if there is no b key present in the map, it will apply the modification function to the i b unit value and insert the result at b.

alter :: forall b i. HasTag b => (Maybe (i b) -> Maybe (i b)) -> BackendMap i -> BackendMap i Source #

The expression alter f bmap alters the value x at b, or absence thereof. alter can be used to insert, delete, or update a value in a Map.

In short : lookup k (alter f k m) = f (lookup k m).