module Jerimum.PostgreSQL.Parser
    -- * Parsers
  ( decodeTimeline
  ) where

import qualified Data.ByteString.Lazy       as L
import qualified Data.ByteString.Lazy.Char8 as L8
import           Jerimum.PostgreSQL.Types

decodeTimeline :: L.ByteString -> Maybe Timeline
decodeTimeline codedTimeline =
  case L8.readInt codedTimeline of
    Just (timeline, "") -> Just timeline
    _                   -> Nothing
