mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 04:51:35 +03:00
be67b0db59
This fixes the simple HLint warnings, and adds a few suppressions to avoid noise. The suppressions don't really solve the problems, but I think the warnings here are quite benign and I'm uncomfortable with how likely I would be to introduce a bug during refactoring. In the case of _pg-client_ and _resource-pool_, we can't use the recommended functions anyway, and there doesn't seem to be a way to tell HLint to ignore entire packages. I have updated the `make` targets to only fail if errors or warnings are found, not suggestions. This brings it in line with the CI job. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8910 GitOrigin-RevId: 596277b4ae5833876fc3f43875208c1279518a59
46 lines
1.5 KiB
Haskell
46 lines
1.5 KiB
Haskell
module Test.Parser.Insert
|
|
( InsertQueryBuilder (..),
|
|
mkInsertQuery,
|
|
)
|
|
where
|
|
|
|
import Hasura.Backends.Postgres.SQL.Types (QualifiedTable)
|
|
import Hasura.Prelude
|
|
import Hasura.RQL.IR.BoolExp (GBoolExp (..))
|
|
import Hasura.RQL.IR.Insert (InsertQueryP1 (..))
|
|
import Hasura.RQL.IR.Returning (MutationOutputG (..))
|
|
import Hasura.RQL.IR.Value (UnpreparedValue (..))
|
|
import Hasura.RQL.Types.Column (ColumnInfo (..))
|
|
import Test.Backend.Postgres.Misc
|
|
|
|
type Output = MutationOutputG PG Void (UnpreparedValue PG)
|
|
|
|
-- | Internal use only. The intended use is through
|
|
-- 'Test.Backend.Postgres.Insert.runTest'.
|
|
--
|
|
-- Build an 'InsertQueryP1', to be used with 'mkInsertQuery'.
|
|
data InsertQueryBuilder = InsertQueryBuilder
|
|
{ -- | the main table for the update
|
|
iqbTable :: QualifiedTable,
|
|
-- | the columns used in the insert statement
|
|
iqbInsertColumns :: [ColumnInfo PG],
|
|
-- | the rows of values to be inserted
|
|
iqbValues :: [[UnpreparedValue PG]],
|
|
-- | the 'Output' clause, e.g., selection set, affected_rows, etc.
|
|
iqbOutput :: Output,
|
|
-- | the table columns (all of them)
|
|
iqbAllColumns :: [ColumnInfo PG]
|
|
}
|
|
|
|
mkInsertQuery :: InsertQueryBuilder -> InsertQueryP1 PG
|
|
mkInsertQuery InsertQueryBuilder {..} =
|
|
InsertQueryP1
|
|
{ iqp1Table = iqbTable,
|
|
iqp1Cols = ciColumn <$> iqbInsertColumns,
|
|
iqp1Tuples = fmap unpreparedValueToSQLExp <$> iqbValues,
|
|
iqp1Conflict = Nothing,
|
|
iqp1CheckCond = (BoolAnd [], Nothing),
|
|
iqp1Output = unpreparedValueToSQLExp <$> iqbOutput,
|
|
iqp1AllCols = iqbAllColumns
|
|
}
|