mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-11-13 09:17:21 +03:00
Move text operator out of SQL.Types. (#406)
GitOrigin-RevId: 25adad545b302fd1dde25ea0365d492dfcdaa71d
This commit is contained in:
parent
6494229f54
commit
62a3bb0d9e
@ -951,3 +951,13 @@ instance (ToSQL v) => ToSQL (SelectWithG v) where
|
||||
f (Alias al, q) = toSQL al <~> "AS" <~> parenB (toSQL q)
|
||||
|
||||
type SelectWith = SelectWithG CTE
|
||||
|
||||
|
||||
-- local helpers
|
||||
|
||||
infixr 6 <+>
|
||||
(<+>) :: (ToSQL a) => Text -> [a] -> TB.Builder
|
||||
(<+>) _ [] = mempty
|
||||
(<+>) kat (x:xs) =
|
||||
toSQL x <> mconcat [ TB.text kat <> toSQL x' | x' <- xs ]
|
||||
{-# INLINE (<+>) #-}
|
||||
|
@ -1,19 +1,20 @@
|
||||
module Hasura.SQL.Types
|
||||
( ToSQL(..)
|
||||
, toSQLTxt
|
||||
, (<+>)
|
||||
, CollectableType(..)
|
||||
)
|
||||
where
|
||||
|
||||
import Hasura.Prelude
|
||||
import Hasura.Incremental (Cacheable)
|
||||
|
||||
import qualified Text.Builder as TB
|
||||
import qualified Text.Builder as TB
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
|
||||
import Hasura.Incremental (Cacheable)
|
||||
|
||||
|
||||
class ToSQL a where
|
||||
toSQL :: a -> TB.Builder
|
||||
|
||||
@ -27,14 +28,6 @@ instance (ToSQL a) => ToSQL (Maybe a) where
|
||||
toSQLTxt :: (ToSQL a) => a -> Text
|
||||
toSQLTxt = TB.run . toSQL
|
||||
|
||||
|
||||
infixr 6 <+>
|
||||
(<+>) :: (ToSQL a) => Text -> [a] -> TB.Builder
|
||||
(<+>) _ [] = mempty
|
||||
(<+>) kat (x:xs) =
|
||||
toSQL x <> mconcat [ TB.text kat <> toSQL x' | x' <- xs ]
|
||||
{-# INLINE (<+>) #-}
|
||||
|
||||
-- | The type of all Postgres types (i.e. scalars and arrays). This type is parameterized so that
|
||||
-- we can have both @'CollectableType' 'PGScalarType'@ and @'CollectableType' 'Hasura.RQL.Types.PGColumnType'@, for
|
||||
-- when we care about the distinction made by 'Hasura.RQL.Types.PGColumnType'. If we ever change
|
||||
|
Loading…
Reference in New Issue
Block a user