module Polysemy.Db.Data.DbConfig where

import Polysemy.Db.Data.DbHost (DbHost)
import Polysemy.Db.Data.DbName (DbName)
import Polysemy.Db.Data.DbPassword (DbPassword)
import Polysemy.Db.Data.DbPort (DbPort)
import Polysemy.Db.Data.DbUser (DbUser)

-- |Connection information for a database.
-- >>> DbConfig "localhost" 5432 "users" "post" "gres"
data DbConfig =
  DbConfig {
    DbConfig -> DbHost
host :: DbHost,
    DbConfig -> DbPort
port :: DbPort,
    DbConfig -> DbName
name :: DbName,
    DbConfig -> DbUser
user :: DbUser,
    DbConfig -> DbPassword
password :: DbPassword
  }
  deriving stock (DbConfig -> DbConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DbConfig -> DbConfig -> Bool
$c/= :: DbConfig -> DbConfig -> Bool
== :: DbConfig -> DbConfig -> Bool
$c== :: DbConfig -> DbConfig -> Bool
Eq, Int -> DbConfig -> ShowS
[DbConfig] -> ShowS
DbConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DbConfig] -> ShowS
$cshowList :: [DbConfig] -> ShowS
show :: DbConfig -> String
$cshow :: DbConfig -> String
showsPrec :: Int -> DbConfig -> ShowS
$cshowsPrec :: Int -> DbConfig -> ShowS
Show, forall x. Rep DbConfig x -> DbConfig
forall x. DbConfig -> Rep DbConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DbConfig x -> DbConfig
$cfrom :: forall x. DbConfig -> Rep DbConfig x
Generic)

json ''DbConfig