{-# OPTIONS_HADDOCK hide #-}
module Database.Tds.Primitives.Collation ( Collation32 (..)
, SortId (..)
, Collation (..)
, getCollation
, putCollation
) where
import Data.Word (Word8(..),Word32(..))
import Data.Binary (Put(..),Get(..))
import qualified Data.Binary.Put as Put
import qualified Data.Binary.Get as Get
type Collation32 = Word32
type SortId = Word8
data Collation = Collation !Collation32 !SortId
deriving (Int -> Collation -> ShowS
[Collation] -> ShowS
Collation -> String
(Int -> Collation -> ShowS)
-> (Collation -> String)
-> ([Collation] -> ShowS)
-> Show Collation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Collation] -> ShowS
$cshowList :: [Collation] -> ShowS
show :: Collation -> String
$cshow :: Collation -> String
showsPrec :: Int -> Collation -> ShowS
$cshowsPrec :: Int -> Collation -> ShowS
Show)
getCollation :: Get Collation
getCollation :: Get Collation
getCollation = do
Word32
coll <- Get Word32
Get.getWord32be
Word8
sort <- Get Word8
Get.getWord8
Collation -> Get Collation
forall (m :: * -> *) a. Monad m => a -> m a
return (Collation -> Get Collation) -> Collation -> Get Collation
forall a b. (a -> b) -> a -> b
$ Word32 -> Word8 -> Collation
Collation Word32
coll Word8
sort
putCollation :: Collation -> Put
putCollation :: Collation -> Put
putCollation (Collation Word32
coll Word8
sort) = do
Word32 -> Put
Put.putWord32be Word32
coll
Word8 -> Put
Put.putWord8 Word8
sort