graphql-engine/server/src-lib/Hasura/Backends/MSSQL/FromIr/Constants.hs
Philip Lykke Carlsen 4ccc830bb8 Tidy up MSSQL.FromIr
## Description

We go through the module `Hasura.Backends.MSSQL.FromIr` and split it into separate self-contained units, which we document.

Note that this PR has a slightly opinionated follow-up PR #3909 .

### Related Issues

Fix #3666

### Solution and Design

The module `FromIr` has given rise to:

* `FromIr.Expression`
* `FromIr.Query`
* `FromIr.Delete`
* `FromIr.Insert`
* `FromIr.Update`
* `FromIr.SelectIntoTempTable`

And `Execute.MutationResponse` has become `FromIr.MutationResponse` (after some slight adaptation of types).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3908
GitOrigin-RevId: 364acf1bcdf74f2e19464c31cdded12bd8e9aa59
2022-03-10 10:34:52 +00:00

57 lines
1.4 KiB
Haskell

-- | This module provides constants that are either:
--
-- * Simply in common user
-- * Define names that that multiple pieces of code reference.
module Hasura.Backends.MSSQL.FromIr.Constants
( trueExpression,
nullExpression,
emptyArrayExpression,
jsonFieldName,
aggSubselectName,
existsFieldName,
aggFieldName,
tempTableNameInserted,
tempTableNameValues,
tempTableNameDeleted,
tempTableNameUpdated,
)
where
import Database.ODBC.SQLServer qualified as ODBC
import Hasura.Backends.MSSQL.Instances.Types ()
import Hasura.Backends.MSSQL.Types.Internal as TSQL
import Hasura.Prelude
trueExpression :: Expression
trueExpression = ValueExpression (ODBC.BoolValue True)
nullExpression :: Expression
nullExpression = ValueExpression $ ODBC.TextValue "null"
emptyArrayExpression :: Expression
emptyArrayExpression = ValueExpression $ ODBC.TextValue "[]"
jsonFieldName :: Text
jsonFieldName = "json"
aggSubselectName :: Text
aggSubselectName = "agg_sub"
existsFieldName :: Text
existsFieldName = "exists_placeholder"
aggFieldName :: Text
aggFieldName = "agg"
tempTableNameInserted :: TempTableName
tempTableNameInserted = TempTableName "inserted"
tempTableNameValues :: TempTableName
tempTableNameValues = TempTableName "values"
tempTableNameDeleted :: TempTableName
tempTableNameDeleted = TempTableName "deleted"
tempTableNameUpdated :: TempTableName
tempTableNameUpdated = TempTableName "updated"