{-# LINE 1 "library/Hasql/LibPq14/Mappings.hsc" #-} module Hasql.LibPq14.Mappings where import Foreign.C.Types (CInt (..)) import Hasql.Prelude data ExecStatus = EmptyQuery | CommandOk | TuplesOk | CopyOut | CopyIn | CopyBoth | BadResponse | NonfatalError | FatalError | SingleTuple | PipelineSync | PipelineAbort deriving (ExecStatus -> ExecStatus -> Bool (ExecStatus -> ExecStatus -> Bool) -> (ExecStatus -> ExecStatus -> Bool) -> Eq ExecStatus forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: ExecStatus -> ExecStatus -> Bool == :: ExecStatus -> ExecStatus -> Bool $c/= :: ExecStatus -> ExecStatus -> Bool /= :: ExecStatus -> ExecStatus -> Bool Eq, Int -> ExecStatus -> ShowS [ExecStatus] -> ShowS ExecStatus -> String (Int -> ExecStatus -> ShowS) -> (ExecStatus -> String) -> ([ExecStatus] -> ShowS) -> Show ExecStatus forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> ExecStatus -> ShowS showsPrec :: Int -> ExecStatus -> ShowS $cshow :: ExecStatus -> String show :: ExecStatus -> String $cshowList :: [ExecStatus] -> ShowS showList :: [ExecStatus] -> ShowS Show) decodeExecStatus :: CInt -> Maybe ExecStatus decodeExecStatus :: CInt -> Maybe ExecStatus decodeExecStatus = \case (CInt 0) -> ExecStatus -> Maybe ExecStatus forall a. a -> Maybe a Just ExecStatus EmptyQuery {-# LINE 26 "library/Hasql/LibPq14/Mappings.hsc" #-} (1) -> Just CommandOk {-# LINE 27 "library/Hasql/LibPq14/Mappings.hsc" #-} (2) -> Just TuplesOk {-# LINE 28 "library/Hasql/LibPq14/Mappings.hsc" #-} (3) -> Just CopyOut {-# LINE 29 "library/Hasql/LibPq14/Mappings.hsc" #-} (4) -> Just CopyIn {-# LINE 30 "library/Hasql/LibPq14/Mappings.hsc" #-} (8) -> Just CopyBoth {-# LINE 31 "library/Hasql/LibPq14/Mappings.hsc" #-} (5) -> Just BadResponse {-# LINE 32 "library/Hasql/LibPq14/Mappings.hsc" #-} (6) -> Just NonfatalError {-# LINE 33 "library/Hasql/LibPq14/Mappings.hsc" #-} (7) -> Just FatalError {-# LINE 34 "library/Hasql/LibPq14/Mappings.hsc" #-} (9) -> Just SingleTuple {-# LINE 35 "library/Hasql/LibPq14/Mappings.hsc" #-} (10) -> Just PipelineSync {-# LINE 36 "library/Hasql/LibPq14/Mappings.hsc" #-} (11) -> Just PipelineAbort {-# LINE 37 "library/Hasql/LibPq14/Mappings.hsc" #-} _ -> Nothing encodeExecStatus :: ExecStatus -> CInt encodeExecStatus :: ExecStatus -> CInt encodeExecStatus = \case ExecStatus EmptyQuery -> CInt 0 {-# LINE 42 "library/Hasql/LibPq14/Mappings.hsc" #-} CommandOk -> 1 {-# LINE 43 "library/Hasql/LibPq14/Mappings.hsc" #-} TuplesOk -> 2 {-# LINE 44 "library/Hasql/LibPq14/Mappings.hsc" #-} CopyOut -> 3 {-# LINE 45 "library/Hasql/LibPq14/Mappings.hsc" #-} CopyIn -> 4 {-# LINE 46 "library/Hasql/LibPq14/Mappings.hsc" #-} CopyBoth -> 8 {-# LINE 47 "library/Hasql/LibPq14/Mappings.hsc" #-} BadResponse -> 5 {-# LINE 48 "library/Hasql/LibPq14/Mappings.hsc" #-} NonfatalError -> 6 {-# LINE 49 "library/Hasql/LibPq14/Mappings.hsc" #-} FatalError -> 7 {-# LINE 50 "library/Hasql/LibPq14/Mappings.hsc" #-} SingleTuple -> 9 {-# LINE 51 "library/Hasql/LibPq14/Mappings.hsc" #-} PipelineSync -> 10 {-# LINE 52 "library/Hasql/LibPq14/Mappings.hsc" #-} PipelineAbort -> 11 {-# LINE 53 "library/Hasql/LibPq14/Mappings.hsc" #-} data PipelineStatus = PipelineOn | PipelineOff | PipelineAborted deriving (PipelineStatus -> PipelineStatus -> Bool (PipelineStatus -> PipelineStatus -> Bool) -> (PipelineStatus -> PipelineStatus -> Bool) -> Eq PipelineStatus forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: PipelineStatus -> PipelineStatus -> Bool == :: PipelineStatus -> PipelineStatus -> Bool $c/= :: PipelineStatus -> PipelineStatus -> Bool /= :: PipelineStatus -> PipelineStatus -> Bool Eq, Int -> PipelineStatus -> ShowS [PipelineStatus] -> ShowS PipelineStatus -> String (Int -> PipelineStatus -> ShowS) -> (PipelineStatus -> String) -> ([PipelineStatus] -> ShowS) -> Show PipelineStatus forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> PipelineStatus -> ShowS showsPrec :: Int -> PipelineStatus -> ShowS $cshow :: PipelineStatus -> String show :: PipelineStatus -> String $cshowList :: [PipelineStatus] -> ShowS showList :: [PipelineStatus] -> ShowS Show) decodePipelineStatus :: CInt -> Maybe PipelineStatus decodePipelineStatus :: CInt -> Maybe PipelineStatus decodePipelineStatus = \case (CInt 1) -> PipelineStatus -> Maybe PipelineStatus forall a. a -> Maybe a Just PipelineStatus PipelineOn {-# LINE 63 "library/Hasql/LibPq14/Mappings.hsc" #-} (0) -> Just PipelineOff {-# LINE 64 "library/Hasql/LibPq14/Mappings.hsc" #-} (2) -> Just PipelineAborted {-# LINE 65 "library/Hasql/LibPq14/Mappings.hsc" #-} _ -> Nothing decodeBool :: CInt -> Maybe Bool decodeBool :: CInt -> Maybe Bool decodeBool = \case CInt 0 -> Bool -> Maybe Bool forall a. a -> Maybe a Just Bool False CInt 1 -> Bool -> Maybe Bool forall a. a -> Maybe a Just Bool True CInt _ -> Maybe Bool forall a. Maybe a Nothing