mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 13:02:11 +03:00
a805f4d185
https://github.com/hasura/graphql-engine-mono/pull/1553 GitOrigin-RevId: b67dc40e54496ed6ad6c85755cf66745664416f7
26 lines
944 B
Haskell
26 lines
944 B
Haskell
module Hasura.Backends.MSSQL.SQL.Value (txtEncodedColVal) where
|
|
|
|
import Hasura.Prelude
|
|
|
|
import qualified Database.ODBC.SQLServer as ODBC
|
|
|
|
import Data.Text.Encoding (decodeUtf8)
|
|
import Data.Text.Extended
|
|
|
|
import qualified Hasura.RQL.Types.Column as RQL
|
|
|
|
import Hasura.Backends.MSSQL.Types.Internal (Value)
|
|
import Hasura.GraphQL.Execute.LiveQuery.Plan ()
|
|
import Hasura.SQL.Backend
|
|
import Hasura.SQL.Value (TxtEncodedVal (..))
|
|
|
|
|
|
txtEncodedVal :: Value -> TxtEncodedVal
|
|
txtEncodedVal ODBC.NullValue = TENull
|
|
txtEncodedVal (ODBC.ByteStringValue b) = TELit $ decodeUtf8 b
|
|
txtEncodedVal (ODBC.TextValue t) = TELit t
|
|
txtEncodedVal val = TELit $ toTxt $ ODBC.toSql val
|
|
|
|
txtEncodedColVal :: RQL.ColumnValue 'MSSQL -> TxtEncodedVal
|
|
txtEncodedColVal = txtEncodedVal . RQL.cvValue
|