mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 13:02:11 +03:00
79a80c3f0a
GitOrigin-RevId: 5888621dfe44f5f710c2431515114ce0e8864e61
24 lines
997 B
Haskell
24 lines
997 B
Haskell
module Hasura.Backends.MSSQL.SQL.Value (txtEncodedColVal) where
|
|
|
|
import Hasura.Prelude
|
|
|
|
import qualified Database.ODBC.SQLServer as ODBC
|
|
import Hasura.GraphQL.Execute.LiveQuery.Plan ()
|
|
import qualified Hasura.RQL.Types.Column as RQL
|
|
|
|
import Data.Text.Encoding (decodeUtf8)
|
|
|
|
import Hasura.Backends.MSSQL.Types.Internal (Expression (..), Value)
|
|
import Hasura.SQL.Backend
|
|
import Hasura.SQL.Types (toSQLTxt)
|
|
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 $ toSQLTxt $ ValueExpression val
|
|
|
|
txtEncodedColVal :: RQL.ColumnValue 'MSSQL -> TxtEncodedVal
|
|
txtEncodedColVal = txtEncodedVal . RQL.cvValue
|