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

Hasura.RQL.Types.Endpoint.Trie

Synopsis

Documentation

type MultiMapPathTrie a k v = Trie (PathComponent a) (MultiMap k v) Source #

Trie from PathComponents to MultiMaps

data PathComponent a Source #

A component in a URL path: either a literal or a wildcard parameter

Constructors

PathLiteral a 
PathParam 

Instances

Instances details
ToJSON a => ToJSON (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

ToJSON a => ToJSONKey (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Generic (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Associated Types

type Rep (PathComponent a) :: Type -> Type #

Show a => Show (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Eq a => Eq (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Ord a => Ord (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Hashable a => Hashable (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

type Rep (PathComponent a) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

type Rep (PathComponent a) = D1 ('MetaData "PathComponent" "Hasura.RQL.Types.Endpoint.Trie" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "PathLiteral" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 a)) :+: C1 ('MetaCons "PathParam" 'PrefixI 'False) (U1 :: Type -> Type))

data MatchResult a k v Source #

Result of matching a path [PathComponent] a and key k in a MultiMapPathTrie.

MatchResult is a lattice where MatchNotFound is the bottom element and MatchAmbiguous is the top element:

MatchAmbiguous / MatchFound v0 as0 MatchFound v1 as1 / MatchMissingKey (ks0 <> ks1) / MatchMissingKey ks0 MatchMissingKey ks1 / MatchNotFound

Constructors

MatchAmbiguous

Multiple results.

MatchFound v [a]

A single unambiguous result. Returns the value found and a list of parameter bindings.

MatchMissingKey (NonEmpty k)

A path was found, but not a key. Returns a list of keys found.

MatchNotFound

Path was not found in the MultiMapPathTrie.

Instances

Instances details
Monoid (MatchResult a k v) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Methods

mempty :: MatchResult a k v #

mappend :: MatchResult a k v -> MatchResult a k v -> MatchResult a k v #

mconcat :: [MatchResult a k v] -> MatchResult a k v #

Semigroup (MatchResult a k v) Source #

Semigroup and Monoid instances implement join (i.e. least upper bound) on the above lattice.

Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Methods

(<>) :: MatchResult a k v -> MatchResult a k v -> MatchResult a k v #

sconcat :: NonEmpty (MatchResult a k v) -> MatchResult a k v #

stimes :: Integral b => b -> MatchResult a k v -> MatchResult a k v #

(Show v, Show a, Show k) => Show (MatchResult a k v) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Methods

showsPrec :: Int -> MatchResult a k v -> ShowS #

show :: MatchResult a k v -> String #

showList :: [MatchResult a k v] -> ShowS #

(Eq v, Eq a, Eq k) => Eq (MatchResult a k v) Source # 
Instance details

Defined in Hasura.RQL.Types.Endpoint.Trie

Methods

(==) :: MatchResult a k v -> MatchResult a k v -> Bool #

(/=) :: MatchResult a k v -> MatchResult a k v -> Bool #

matchPath :: (Hashable k, Hashable a) => k -> [a] -> MultiMapPathTrie a k v -> MatchResult a k v Source #

Match a key k and path [a] against a MultiMapPathTrie a k v

ambiguousPathsGrouped :: (Hashable a, Hashable k, Ord v, Ord a) => MultiMapPathTrie a k v -> [(Set [PathComponent a], Set v)] Source #

A version of ambiguousPaths that attempts to group all ambiguous paths that have overlapping endpoints

ambiguousPaths :: (Hashable a, Hashable k, Ord v) => MultiMapPathTrie a k v -> [([PathComponent a], Set v)] Source #

Detect and return all ambiguous paths in the MultiMapPathTrie A path p is ambiguous if matchPath k p can return MatchAmbiguous for some k.