8000 Small improvements · postgres-haskell/postgres-wire@e897fa3 · GitHub
[go: up one dir, main page]

Skip to content

Commit e897fa3

Browse files
Small improvements
1 parent 4ac1d9f commit e897fa3

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Database/PostgreSQL/Protocol/Encoders.hs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
module Database.PostgreSQL.Protocol.Encoders where
1+
module Database.PostgreSQL.Protocol.Encoders
2+
( encodeStartMessage
3+
, encodeClientMessage
4+
) where
25

3-
import Data.Word
4-
import Data.Int
5-
import Data.Monoid
6-
import Data.Foldable
6+
import Data.Int (Int32)
7+
import Data.Monoid ((<>))
78
import qualified Data.Vector as V
89
import qualified Data.ByteString as B
910

@@ -72,7 +73,7 @@ encodeClientMessage Sync
7273
encodeClientMessage Terminate
7374
= prependHeader 'X' mempty
7475

75-
-- Encodes single data values. Length `-1` indicates a NULL parameter value.
76+
-- | Encodes single data values. Length `-1` indicates a NULL parameter value.
7677
-- No value bytes follow in the NULL case.
7778
encodeValue :: Maybe B.ByteString -> Encode
7879
encodeValue Nothing = putInt32BE (-1)
@@ -83,10 +84,6 @@ encodeFormat :: Format -> Encode
8384
encodeFormat Text = putInt16BE 0
8485
encodeFormat Binary = putInt16BE 1
8586

86-
----------
87-
-- Utils
88-
---------
89-
9087
prependHeader :: Char -> Encode -> Encode
9188
prependHeader c payload =
9289
-- Length includes itself but not the first message-type byte

0 commit comments

Comments
 (0)
0