mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-11-26 23:33:02 +03:00
0a1eef918c
The ByteString 0.11 package included with GHC 9.2 droppped a few long deprecated modules and functions.
31 lines
720 B
Haskell
31 lines
720 B
Haskell
module Hasql.Private.Commands
|
|
(
|
|
Commands,
|
|
asBytes,
|
|
setEncodersToUTF8,
|
|
setMinClientMessagesToWarning,
|
|
)
|
|
where
|
|
|
|
import Hasql.Private.Prelude
|
|
import qualified Data.ByteString as B
|
|
import qualified Data.ByteString.Builder as BB
|
|
import qualified Data.ByteString.Lazy as BL
|
|
|
|
|
|
newtype Commands =
|
|
Commands (DList BB.Builder)
|
|
deriving (Semigroup, Monoid)
|
|
|
|
asBytes :: Commands -> ByteString
|
|
asBytes (Commands list) =
|
|
BL.toStrict $ BB.toLazyByteString $ foldMap (<> BB.char7 ';') $ list
|
|
|
|
setEncodersToUTF8 :: Commands
|
|
setEncodersToUTF8 =
|
|
Commands (pure "SET client_encoding = 'UTF8'")
|
|
|
|
setMinClientMessagesToWarning :: Commands
|
|
setMinClientMessagesToWarning =
|
|
Commands (pure "SET client_min_messages TO WARNING")
|