module Hasql.Pool.Config.Defaults where

import Hasql.Connection.Setting qualified as Connection.Setting
import Hasql.Connection.Setting.Connection qualified as Connection.Setting.Connection
import Hasql.Pool.Observation (Observation)
import Hasql.Pool.Prelude
import Hasql.Session qualified as Session

-- |
-- 3 connections.
size :: Int
size :: Int
size = Int
3

-- |
-- 10 seconds.
acquisitionTimeout :: DiffTime
acquisitionTimeout :: DiffTime
acquisitionTimeout = DiffTime
10

-- |
-- 1 day.
agingTimeout :: DiffTime
agingTimeout :: DiffTime
agingTimeout = DiffTime
60 DiffTime -> DiffTime -> DiffTime
forall a. Num a => a -> a -> a
* DiffTime
60 DiffTime -> DiffTime -> DiffTime
forall a. Num a => a -> a -> a
* DiffTime
24

-- |
-- 10 minutes.
idlenessTimeout :: DiffTime
idlenessTimeout :: DiffTime
idlenessTimeout = DiffTime
60 DiffTime -> DiffTime -> DiffTime
forall a. Num a => a -> a -> a
* DiffTime
10

-- |
-- > "postgresql://postgres:postgres@localhost:5432/postgres"
staticConnectionSettings :: [Connection.Setting.Setting]
staticConnectionSettings :: [Setting]
staticConnectionSettings =
  [ Connection -> Setting
Connection.Setting.connection (Text -> Connection
Connection.Setting.Connection.string Text
"postgresql://postgres:postgres@localhost:5432/postgres")
  ]

-- |
-- > pure "postgresql://postgres:postgres@localhost:5432/postgres"
dynamicConnectionSettings :: IO [Connection.Setting.Setting]
dynamicConnectionSettings :: IO [Setting]
dynamicConnectionSettings = [Setting] -> IO [Setting]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [Setting]
staticConnectionSettings

-- |
-- > const (pure ())
observationHandler :: Observation -> IO ()
observationHandler :: Observation -> IO ()
observationHandler = IO () -> Observation -> IO ()
forall a b. a -> b -> a
const (() -> IO ()
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

-- |
-- > pure ()
initSession :: Session.Session ()
initSession :: Session ()
initSession = () -> Session ()
forall a. a -> Session a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()