{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
module PostgREST.Config.PgVersion
( PgVersion(..)
, minimumPgVersion
, pgVersion95
, pgVersion96
, pgVersion100
, pgVersion109
, pgVersion110
, pgVersion112
, pgVersion114
, pgVersion121
, pgVersion130
) where
import qualified Data.Aeson as JSON
import Protolude
data PgVersion = PgVersion
{ PgVersion -> Int32
pgvNum :: Int32
, PgVersion -> Text
pgvName :: Text
}
deriving (PgVersion -> PgVersion -> Bool
(PgVersion -> PgVersion -> Bool)
-> (PgVersion -> PgVersion -> Bool) -> Eq PgVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PgVersion -> PgVersion -> Bool
$c/= :: PgVersion -> PgVersion -> Bool
== :: PgVersion -> PgVersion -> Bool
$c== :: PgVersion -> PgVersion -> Bool
Eq, (forall x. PgVersion -> Rep PgVersion x)
-> (forall x. Rep PgVersion x -> PgVersion) -> Generic PgVersion
forall x. Rep PgVersion x -> PgVersion
forall x. PgVersion -> Rep PgVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PgVersion x -> PgVersion
$cfrom :: forall x. PgVersion -> Rep PgVersion x
Generic, [PgVersion] -> Encoding
[PgVersion] -> Value
PgVersion -> Encoding
PgVersion -> Value
(PgVersion -> Value)
-> (PgVersion -> Encoding)
-> ([PgVersion] -> Value)
-> ([PgVersion] -> Encoding)
-> ToJSON PgVersion
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [PgVersion] -> Encoding
$ctoEncodingList :: [PgVersion] -> Encoding
toJSONList :: [PgVersion] -> Value
$ctoJSONList :: [PgVersion] -> Value
toEncoding :: PgVersion -> Encoding
$ctoEncoding :: PgVersion -> Encoding
toJSON :: PgVersion -> Value
$ctoJSON :: PgVersion -> Value
JSON.ToJSON)
instance Ord PgVersion where
(PgVersion Int32
v1 Text
_) compare :: PgVersion -> PgVersion -> Ordering
`compare` (PgVersion Int32
v2 Text
_) = Int32
v1 Int32 -> Int32 -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` Int32
v2
minimumPgVersion :: PgVersion
minimumPgVersion :: PgVersion
minimumPgVersion = PgVersion
pgVersion95
pgVersion95 :: PgVersion
pgVersion95 :: PgVersion
pgVersion95 = Int32 -> Text -> PgVersion
PgVersion Int32
90500 Text
"9.5"
pgVersion96 :: PgVersion
pgVersion96 :: PgVersion
pgVersion96 = Int32 -> Text -> PgVersion
PgVersion Int32
90600 Text
"9.6"
pgVersion100 :: PgVersion
pgVersion100 :: PgVersion
pgVersion100 = Int32 -> Text -> PgVersion
PgVersion Int32
100000 Text
"10"
pgVersion109 :: PgVersion
pgVersion109 :: PgVersion
pgVersion109 = Int32 -> Text -> PgVersion
PgVersion Int32
100009 Text
"10.9"
pgVersion110 :: PgVersion
pgVersion110 :: PgVersion
pgVersion110 = Int32 -> Text -> PgVersion
PgVersion Int32
110000 Text
"11.0"
pgVersion112 :: PgVersion
pgVersion112 :: PgVersion
pgVersion112 = Int32 -> Text -> PgVersion
PgVersion Int32
110002 Text
"11.2"
pgVersion114 :: PgVersion
pgVersion114 :: PgVersion
pgVersion114 = Int32 -> Text -> PgVersion
PgVersion Int32
110004 Text
"11.4"
pgVersion121 :: PgVersion
pgVersion121 :: PgVersion
pgVersion121 = Int32 -> Text -> PgVersion
PgVersion Int32
120001 Text
"12.1"
pgVersion130 :: PgVersion
pgVersion130 :: PgVersion
pgVersion130 = Int32 -> Text -> PgVersion
PgVersion Int32
130000 Text
"13.0"