Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines functions that translate from the Postgres IR into Postgres SQL AST.
NOTE: These functions processAnnAggregateSelect
, processAnnSimpleSelect
,
processConnectionSelect
, are all mutually recursive.
These functions are generally called from the top level functions in Translate.Select, and the call stack looks like:
selectQuerySQL
->mkSQLSelect
->processAnnSimpleSelect
->processSelectParams
/processAnnFields
selectAggregateQuerySQL
->mkAggregateSelect
->processAnnAggregateSelect
->processSelectParams
/processAnnFields
connetionSelectQuerySQL
->mkConnectionSelect
->processConnectionSelection
->processSelectParams
SelectSource
consists of a prefix, a source, a boolean conditional
expression, and info on whether sorting or slicing is done (needed to handle
the LIMIT optimisation)
Documentation
processAnnAggregateSelect :: forall pgKind m. (MonadReader StringifyNumbers m, MonadWriter SelectWriter m, MonadState NativeQueryFreshIdStore m, Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => SourcePrefixes -> FieldName -> AnnAggregateSelect ('Postgres pgKind) -> m (SelectSource, InsOrdHashMap ColumnAlias SQLExp, Extractor) Source #
processAnnSimpleSelect :: forall pgKind m. (MonadReader StringifyNumbers m, MonadState NativeQueryFreshIdStore m, MonadWriter SelectWriter m, Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => SourcePrefixes -> FieldName -> PermissionLimitSubQuery -> AnnSimpleSelect ('Postgres pgKind) -> m (SelectSource, InsOrdHashMap ColumnAlias SQLExp) Source #
processConnectionSelect :: forall pgKind m. (MonadReader StringifyNumbers m, MonadWriter SelectWriter m, MonadState NativeQueryFreshIdStore m, Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => SourcePrefixes -> FieldName -> TableAlias -> HashMap PGCol PGCol -> ConnectionSelect ('Postgres pgKind) Void SQLExp -> m (ArrayConnectionSource, Extractor, InsOrdHashMap ColumnAlias SQLExp) Source #