graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.SQL.BackendMap

Synopsis

Documentation

data 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

Instances

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

Defined in Hasura.SQL.BackendMap

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

Defined in Hasura.SQL.BackendMap

(SatisfiesForAllBackends i HasCodec, SatisfiesForAllBackends i (Typeable :: Type -> Constraint)) => HasCodec (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Monoid (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Semigroup (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 #

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

Defined in Hasura.SQL.BackendMap

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 #

Select (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

Associated Types

type Selector (BackendMap i) :: Type -> Type Source #

Methods

select :: Selector (BackendMap i) b -> BackendMap i -> b Source #

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)))))
type Selector (BackendMap i) Source # 
Instance details

Defined in Hasura.SQL.BackendMap

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

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).

overridesDeeply :: i `SatisfiesForAllBackends` Semigroup => BackendMap i -> BackendMap i -> BackendMap i Source #

The expression a `overridesDeeply b applies the values from a on top of the defaults b. In practice this should union the maps for each backend type.