Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type SessionVarType b = CollectableType (ScalarType b)
- data ComputedFieldReturnType (b :: BackendType)
- = ReturnsScalar (ScalarType b)
- | ReturnsTable (TableName b)
- | ReturnsOthers
- type XEnable = ()
- type XDisable = Void
- data SupportedNamingCase
- class (HasSourceConfiguration b, Representable (BasicOrderType b), Representable (Column b), Representable (ComputedFieldDefinition b), Representable (ComputedFieldImplicitArguments b), Representable (ComputedFieldReturn b), Representable (ConstraintName b), Representable (ExtraTableMetadata b), Representable (FunctionArgument b), Representable (FunctionName b), Representable (FunctionReturnType b), Representable (HealthCheckTest b), Representable (NullsOrderType b), Representable (SQLExpression b), Representable (ScalarSelectionArguments b), Representable (ScalarType b), Representable (XComputedField b), Representable (XGroupBy b), Representable (TableName b), Eq (RawFunctionInfo b), Show (RawFunctionInfo b), Representable (ResolvedConnectionTemplate b), Ord (TableName b), Ord (FunctionName b), Ord (ScalarType b), Ord (Column b), Ord (ComputedFieldReturn b), Ord (ComputedFieldImplicitArguments b), Ord (ConstraintName b), Ord (FunctionArgument b), Ord (XComputedField b), Data (TableName b), FromJSON (BackendConfig b), FromJSON (Column b), FromJSON (ComputedFieldDefinition b), FromJSON (ConnectionTemplateRequestContext b), FromJSON (ConstraintName b), FromJSON (ExtraTableMetadata b), FromJSON (FunctionName b), FromJSON (FunctionReturnType b), FromJSON (HealthCheckTest b), FromJSON (RawFunctionInfo b), FromJSON (ScalarType b), FromJSON (TableName b), FromJSONKey (Column b), FromJSONKey (ConstraintName b), HasCodec (BackendConfig b), HasCodec (BackendSourceKind b), HasCodec (Column b), HasCodec (ComputedFieldDefinition b), HasCodec (FunctionName b), HasCodec (FunctionReturnType b), HasCodec (ScalarType b), HasCodec (TableName b), ToJSON (BackendConfig b), ToJSON (Column b), ToJSON (ConstraintName b), ToJSON (ExecutionStatistics b), ToJSON (FunctionArgument b), ToJSON (FunctionName b), ToJSON (FunctionReturnType b), ToJSON (RawFunctionInfo b), ToJSON (ScalarType b), ToJSON (TableName b), ToJSON (ExtraTableMetadata b), ToJSON (SQLExpression b), ToJSON (ComputedFieldDefinition b), ToJSON (ComputedFieldImplicitArguments b), ToJSON (ComputedFieldReturn b), ToJSON (HealthCheckTest b), ToJSON (ResolvedConnectionTemplate b), ToJSONKey (Column b), ToJSONKey (ConstraintName b), ToJSONKey (ScalarType b), ToTxt (Column b), ToTxt (FunctionName b), ToTxt (ScalarType b), ToTxt (TableName b), ToTxt (ConstraintName b), ToErrorValue (Column b), ToErrorValue (TableName b), Typeable (Column b), Typeable b, HasTag b, Traversable (CountType b), Traversable (FunctionArgumentExp b), Eq (BackendConfig b), Show (BackendConfig b), Eq (BackendInfo b), Show (BackendInfo b), Monoid (BackendInfo b), Eq (ScalarValue b), Show (ScalarValue b), Eq (XNodesAgg b), Show (XNodesAgg b), Eq (XRelay b), Show (XRelay b), Eq (XStreamingSubscription b), Show (XStreamingSubscription b), Eq (XNestedObjects b), Ord (XNestedObjects b), Show (XNestedObjects b), NFData (XNestedObjects b), Hashable (XNestedObjects b), ToJSON (XNestedObjects b), FromJSON (XNestedObjects b), ToTxt (XNestedObjects b), Traversable (BooleanOperators b), Traversable (UpdateVariant b), Traversable (BackendInsert b), Traversable (AggregationPredicates b)) => Backend (b :: BackendType) where
- type BackendConfig b :: Type
- type BackendInfo b :: Type
- type TableName b :: Type
- type FunctionName b :: Type
- type FunctionReturnType b :: Type
- type RawFunctionInfo b :: Type
- type ConstraintName b :: Type
- type BasicOrderType b :: Type
- type NullsOrderType b :: Type
- type CountType b :: Type -> Type
- type Column b :: Type
- type ScalarValue b :: Type
- type ScalarType b :: Type
- type SQLExpression b :: Type
- type ComputedFieldDefinition b :: Type
- type ScalarSelectionArguments b :: Type
- type ExtraTableMetadata b :: Type
- type FunctionArgument b :: Type
- type FunctionArgumentExp b :: Type -> Type
- type ComputedFieldImplicitArguments b :: Type
- type ComputedFieldReturn b :: Type
- type HealthCheckTest b :: Type
- type BooleanOperators b :: Type -> Type
- type AggregationPredicates b :: Type -> Type
- type UpdateVariant b :: Type -> Type
- type BackendInsert b :: Type -> Type
- type XComputedField b :: Type
- type XRelay b :: Type
- type XNodesAgg b :: Type
- type XEventTriggers b :: Type
- type XNestedInserts b :: Type
- type XStreamingSubscription b :: Type
- type XNestedObjects b :: Type
- type XGroupBy b :: Type
- type ResolvedConnectionTemplate b :: Type
- type ConnectionTemplateRequestContext b :: Type
- type ExecutionStatistics b :: Type
- healthCheckImplementation :: Maybe (HealthCheckImplementation (HealthCheckTest b))
- versionCheckImplementation :: Environment -> SourceConnConfiguration b -> IO (Either QErr ())
- runPingSource :: Environment -> (String -> IO ()) -> SourceName -> SourceConnConfiguration b -> IO ()
- resolveConnectionTemplate :: SourceConfig b -> ConnectionTemplateRequestContext b -> Maybe ConnectionTemplate -> Either QErr EncJSON
- isComparableType :: ScalarType b -> Bool
- isNumType :: ScalarType b -> Bool
- getCustomAggregateOperators :: SourceConfig b -> HashMap Name (HashMap (ScalarType b) (ScalarType b))
- textToScalarValue :: Maybe Text -> ScalarValue b
- parseScalarValue :: ScalarTypeParsingContext b -> ScalarType b -> Value -> Either QErr (ScalarValue b)
- scalarValueToJSON :: ScalarValue b -> Value
- functionToTable :: FunctionName b -> TableName b
- tableToFunction :: TableName b -> FunctionName b
- computedFieldFunction :: ComputedFieldDefinition b -> FunctionName b
- computedFieldReturnType :: ComputedFieldReturn b -> ComputedFieldReturnType b
- supportsAggregateComputedFields :: Bool
- fromComputedFieldImplicitArguments :: v -> ComputedFieldImplicitArguments b -> [FunctionArgumentExp b v]
- tableGraphQLName :: TableName b -> Either QErr Name
- functionGraphQLName :: FunctionName b -> Either QErr Name
- getTableIdentifier :: TableName b -> Either QErr GQLNameIdentifier
- snakeCaseTableName :: TableName b -> Text
- namingConventionSupport :: SupportedNamingCase
- resizeSourcePools :: SourceConfig b -> ServerReplicas -> IO SourceResizePoolSummary
- defaultTriggerOnReplication :: Maybe (XEventTriggers b, TriggerOnReplication)
- backendSupportsNestedObjects :: Either QErr (XNestedObjects b)
- sourceSupportsSchemalessTables :: SourceConfig b -> Bool
- _ReturnsTable :: forall b. Prism' (ComputedFieldReturnType b) (TableName b)
Documentation
type SessionVarType b = CollectableType (ScalarType b) Source #
data ComputedFieldReturnType (b :: BackendType) Source #
data SupportedNamingCase Source #
Used for keeping track of the extent of support of naming convention across different backends.
AllConventions
implies a full support whereas OnlyHasuraCase
implies
a partial support of only HasuraCase
class (HasSourceConfiguration b, Representable (BasicOrderType b), Representable (Column b), Representable (ComputedFieldDefinition b), Representable (ComputedFieldImplicitArguments b), Representable (ComputedFieldReturn b), Representable (ConstraintName b), Representable (ExtraTableMetadata b), Representable (FunctionArgument b), Representable (FunctionName b), Representable (FunctionReturnType b), Representable (HealthCheckTest b), Representable (NullsOrderType b), Representable (SQLExpression b), Representable (ScalarSelectionArguments b), Representable (ScalarType b), Representable (XComputedField b), Representable (XGroupBy b), Representable (TableName b), Eq (RawFunctionInfo b), Show (RawFunctionInfo b), Representable (ResolvedConnectionTemplate b), Ord (TableName b), Ord (FunctionName b), Ord (ScalarType b), Ord (Column b), Ord (ComputedFieldReturn b), Ord (ComputedFieldImplicitArguments b), Ord (ConstraintName b), Ord (FunctionArgument b), Ord (XComputedField b), Data (TableName b), FromJSON (BackendConfig b), FromJSON (Column b), FromJSON (ComputedFieldDefinition b), FromJSON (ConnectionTemplateRequestContext b), FromJSON (ConstraintName b), FromJSON (ExtraTableMetadata b), FromJSON (FunctionName b), FromJSON (FunctionReturnType b), FromJSON (HealthCheckTest b), FromJSON (RawFunctionInfo b), FromJSON (ScalarType b), FromJSON (TableName b), FromJSONKey (Column b), FromJSONKey (ConstraintName b), HasCodec (BackendConfig b), HasCodec (BackendSourceKind b), HasCodec (Column b), HasCodec (ComputedFieldDefinition b), HasCodec (FunctionName b), HasCodec (FunctionReturnType b), HasCodec (ScalarType b), HasCodec (TableName b), ToJSON (BackendConfig b), ToJSON (Column b), ToJSON (ConstraintName b), ToJSON (ExecutionStatistics b), ToJSON (FunctionArgument b), ToJSON (FunctionName b), ToJSON (FunctionReturnType b), ToJSON (RawFunctionInfo b), ToJSON (ScalarType b), ToJSON (TableName b), ToJSON (ExtraTableMetadata b), ToJSON (SQLExpression b), ToJSON (ComputedFieldDefinition b), ToJSON (ComputedFieldImplicitArguments b), ToJSON (ComputedFieldReturn b), ToJSON (HealthCheckTest b), ToJSON (ResolvedConnectionTemplate b), ToJSONKey (Column b), ToJSONKey (ConstraintName b), ToJSONKey (ScalarType b), ToTxt (Column b), ToTxt (FunctionName b), ToTxt (ScalarType b), ToTxt (TableName b), ToTxt (ConstraintName b), ToErrorValue (Column b), ToErrorValue (TableName b), Typeable (Column b), Typeable b, HasTag b, Traversable (CountType b), Traversable (FunctionArgumentExp b), Eq (BackendConfig b), Show (BackendConfig b), Eq (BackendInfo b), Show (BackendInfo b), Monoid (BackendInfo b), Eq (ScalarValue b), Show (ScalarValue b), Eq (XNodesAgg b), Show (XNodesAgg b), Eq (XRelay b), Show (XRelay b), Eq (XStreamingSubscription b), Show (XStreamingSubscription b), Eq (XNestedObjects b), Ord (XNestedObjects b), Show (XNestedObjects b), NFData (XNestedObjects b), Hashable (XNestedObjects b), ToJSON (XNestedObjects b), FromJSON (XNestedObjects b), ToTxt (XNestedObjects b), Traversable (BooleanOperators b), Traversable (UpdateVariant b), Traversable (BackendInsert b), Traversable (AggregationPredicates b)) => Backend (b :: BackendType) where Source #
Mapping from abstract types to concrete backend representation
The RQL IR, used as the output of GraphQL parsers and of the RQL parsers, is backend-agnostic: it uses an abstract representation of the structure of a query, and delegates to the backends the task of choosing an appropriate concrete representation.
Additionally, grouping all those types under one typeclass rather than having dedicated type families allows to explicitly list all typeclass requirements, which simplifies the instance declarations of all IR types.
There are no injectivity requirements on those type families: it's
okay for two different backends to use the same types. That means,
however, that functions cannot identify to what backend b a given
TableName b
refers to; most generic functions will need either a
type application or a Proxy
parameter to disambiguate between
different backends at the call site.
isComparableType, isNumType, textToScalarValue, parseScalarValue, scalarValueToJSON, functionToTable, tableToFunction, computedFieldFunction, computedFieldReturnType, fromComputedFieldImplicitArguments, tableGraphQLName, functionGraphQLName, getTableIdentifier, snakeCaseTableName, namingConventionSupport, resizeSourcePools, defaultTriggerOnReplication
type BackendConfig b :: Type Source #
Backend configuration stored in metadata
type BackendInfo b :: Type Source #
Runtime backend info derived from (possibly enriched) BackendConfig and stored in SchemaCache
type TableName b :: Type Source #
type FunctionName b :: Type Source #
type FunctionReturnType b :: Type Source #
type FunctionReturnType b = XDisable
type RawFunctionInfo b :: Type Source #
type ConstraintName b :: Type Source #
type BasicOrderType b :: Type Source #
type NullsOrderType b :: Type Source #
type CountType b :: Type -> Type Source #
The type that captures how count aggregations are modelled
It is parameterised over the type of fields, which changes during the IR translation phases.
type Column b :: Type Source #
type ScalarValue b :: Type Source #
type ScalarType b :: Type Source #
type SQLExpression b :: Type Source #
type ComputedFieldDefinition b :: Type Source #
type ScalarSelectionArguments b :: Type Source #
Arguments of a scalar field's selection { query { some_table { # a scalar field column(ScalarSelectionArguments) } } }
type ExtraTableMetadata b :: Type Source #
type FunctionArgument b :: Type Source #
FunctionArgument
type FunctionArgumentExp b :: Type -> Type Source #
Function input argument expression
It is parameterised over the type of fields, which changes during the IR translation phases.
type ComputedFieldImplicitArguments b :: Type Source #
Computed field function argument values which are being implicitly inferred from table and/or session information
type ComputedFieldReturn b :: Type Source #
Computed field return information
type HealthCheckTest b :: Type Source #
A config type for health check tests
type BooleanOperators b :: Type -> Type Source #
Intermediate Representation of extensions to the shared set of boolean operators on table fields.
It is parameterised over the type of fields, which changes during the IR translation phases.
type AggregationPredicates b :: Type -> Type Source #
Intermediate Representation of aggregation predicates. The default implementation makes aggregation predicates uninstantiable.
It is parameterised over the type of fields, which changes during the IR translation phases.
type AggregationPredicates b = Const Void
type UpdateVariant b :: Type -> Type Source #
The different variants of update supported by a backend for their intermediate representation. For example, a backend could use a sum type encapsulating either a single batch update or multiple batch updates.
The default implementation makes update expressions uninstantiable.
It is parameterised over the type of fields, which changes during the IR translation phases.
type UpdateVariant b = Const Void
type BackendInsert b :: Type -> Type Source #
Intermediate Representation of Insert Mutations. The default implementation makes insert expressions uninstantiable.
It is parameterised over the type of fields, which changes during the IR translation phases.
type BackendInsert b = Const Void
type XComputedField b :: Type Source #
type XRelay b :: Type Source #
type XNodesAgg b :: Type Source #
type XEventTriggers b :: Type Source #
Flag the availability of event triggers.
type XNestedInserts b :: Type Source #
Extension to flag the availability of object and array relationships in inserts (aka nested inserts).
type XStreamingSubscription b :: Type Source #
type XNestedObjects b :: Type Source #
type XNestedObjects b = XDisable
type XGroupBy b :: Type Source #
type ResolvedConnectionTemplate b :: Type Source #
type ResolvedConnectionTemplate b = ()
type ConnectionTemplateRequestContext b :: Type Source #
type ConnectionTemplateRequestContext b = ()
type ExecutionStatistics b :: Type Source #
Information about the query execution that may be useful for debugging or reporting.
type ExecutionStatistics b = ()
healthCheckImplementation :: Maybe (HealthCheckImplementation (HealthCheckTest b)) Source #
A backend type can opt into supporting health checks by providing an implementation that includes a default health check test, and a health check test codec.
versionCheckImplementation :: Environment -> SourceConnConfiguration b -> IO (Either QErr ()) Source #
An Implementation for version checking when adding a source.
runPingSource :: Environment -> (String -> IO ()) -> SourceName -> SourceConnConfiguration b -> IO () Source #
A backend type can opt into providing an implementation for fingerprinted pings to the source, useful for attribution that the user is using Hasura
resolveConnectionTemplate :: SourceConfig b -> ConnectionTemplateRequestContext b -> Maybe ConnectionTemplate -> Either QErr EncJSON Source #
isComparableType :: ScalarType b -> Bool Source #
isNumType :: ScalarType b -> Bool Source #
getCustomAggregateOperators :: SourceConfig b -> HashMap Name (HashMap (ScalarType b) (ScalarType b)) Source #
Custom aggregate operators supported by the backend. Backends that support custom aggregate operators should return a HashMap from operator name to a scalar type mapping. In the scalar type mapping the key represents the input type for the operator and the value represents the result type. Backends that do not support custom aggregate operators can use the default implementation which returns an empty map.
textToScalarValue :: Maybe Text -> ScalarValue b Source #
parseScalarValue :: ScalarTypeParsingContext b -> ScalarType b -> Value -> Either QErr (ScalarValue b) Source #
scalarValueToJSON :: ScalarValue b -> Value Source #
functionToTable :: FunctionName b -> TableName b Source #
tableToFunction :: TableName b -> FunctionName b Source #
computedFieldFunction :: ComputedFieldDefinition b -> FunctionName b Source #
computedFieldReturnType :: ComputedFieldReturn b -> ComputedFieldReturnType b Source #
supportsAggregateComputedFields :: Bool Source #
Backends that don't support aggregate computed fields will never
encounter an SelectionField
. However, backends are
expected to provide a total transformation from SelectionField
to the
backend's query language.
Rather than implement error handling for every backend that doesn't support aggregate computed fields, and then remove that error handling for each backend when we add support - honestly, adding error handling would probably take longer than adding aggregate computed field support - we instead have a flag.
If a backend declares this flag as False
, computed fields will not be
added to the GraphQL schema. This means that backends can safely handle
SFComputedField
with a runtime exception as long as this flag is
False
.
Once all backends support all aggregate computed field operations, this flag can be deleted.
fromComputedFieldImplicitArguments :: v -> ComputedFieldImplicitArguments b -> [FunctionArgumentExp b v] Source #
Build function arguments expression from computed field implicit arguments
tableGraphQLName :: TableName b -> Either QErr Name Source #
functionGraphQLName :: FunctionName b -> Either QErr Name Source #
getTableIdentifier :: TableName b -> Either QErr GQLNameIdentifier Source #
snakeCaseTableName :: TableName b -> Text Source #
namingConventionSupport :: SupportedNamingCase Source #
resizeSourcePools :: SourceConfig b -> ServerReplicas -> IO SourceResizePoolSummary Source #
defaultTriggerOnReplication :: Maybe (XEventTriggers b, TriggerOnReplication) Source #
Default behaviour of SQL triggers on logically replicated database.
Setting this to Nothing
will disable event trigger configuration in the
metadata.
backendSupportsNestedObjects :: Either QErr (XNestedObjects b) Source #
default backendSupportsNestedObjects :: XNestedObjects b ~ XDisable => Either QErr (XNestedObjects b) Source #
sourceSupportsSchemalessTables :: SourceConfig b -> Bool Source #
Instances
_ReturnsTable :: forall b. Prism' (ComputedFieldReturnType b) (TableName b) Source #