hasql-resource-pool 0.5.3.2 → 0.5.4.0
raw patch · 4 files changed
+41/−49 lines, 4 filesdep ~hasqlPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: hasql
API changes (from Hackage documentation)
- Hasql.Pool.Observer: Observed :: Rational -> Observed
- Hasql.Pool.Observer: [latency] :: Observed -> Rational
- Hasql.Pool.Observer: instance GHC.Show.Show Hasql.Pool.Observer.Observed
- Hasql.Pool.Observer: newtype Observed
- Hasql.Pool.Observer: type ObserverAction = Observed -> IO ()
+ Hasql.Pool: type ConnectionGetter = IO (Either ConnectionError Connection)
Files
- CHANGELOG.md +4/−4
- hasql-resource-pool.cabal +20/−36
- library/Hasql/Pool.hs +15/−5
- library/Hasql/Pool/Observer.hs +2/−4
CHANGELOG.md view
@@ -1,11 +1,11 @@-# 0.5.3.2+# 0.5.3.1 -* `Hasql.Pool.Observer` is an exposed module.+* `acquireWithStripes` renamed to `aquireWith` and allows specifying a custom `ConnectionGetter`. -# 0.5.3.1+# 0.5.4.0 -* `acquireWithStripes` renamed to `aquireWith` and allows specifying a custom `ConnectionGetter`.+Upgrade to support breaking changes of `hasql-1.6.3`. No breaking changes introduced to the library. # 0.5.3
hasql-resource-pool.cabal view
@@ -1,61 +1,45 @@-name:- hasql-resource-pool-version:- 0.5.3.2-category:- Hasql, Database, PostgreSQL-synopsis:- A pool of connections for Hasql based on resource-pool.-description:- This package is derived from hasql-pool v0.5.2.2 and continues using resource-pool for an underlying pool implementation.-homepage:- https://github.com/avanov/hasql-resource-pool-bug-reports:- https://github.com/avanov/hasql-resource-pool/issues-author:- Nikita Volkov <nikita.y.volkov@mail.ru>-maintainer:- Maxim Avanov <maxim.avanov@gmail.com>-copyright:- (c) 2022, Maxim Avanov-license:- MIT-license-file:- LICENSE-build-type:- Simple-cabal-version:- >=1.10+name: hasql-resource-pool+version: 0.5.4.0+category: Hasql, Database, PostgreSQL+synopsis: A pool of connections for Hasql based on resource-pool.+description: This package is derived from hasql-pool v0.5.2.2 and continues using resource-pool for an underlying pool implementation.+homepage: https://github.com/avanov/hasql-resource-pool+bug-reports: https://github.com/avanov/hasql-resource-pool/issues+author: Nikita Volkov <nikita.y.volkov@mail.ru>+maintainer: Maxim Avanov <maxim.avanov@gmail.com>+copyright: (c) 2023, Maxim Avanov+license: MIT+license-file: LICENSE+build-type: Simple+cabal-version: >=1.10+ extra-source-files: CHANGELOG.md README.md source-repository head- type:- git- location:- git://github.com/avanov/hasql-resource-pool.git+ type: git+ location: git://github.com/avanov/hasql-resource-pool.git library- hs-source-dirs:- library+ hs-source-dirs: library ghc-options: default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples default-language: Haskell2010 other-modules:+ Hasql.Pool.Observer Hasql.Pool.Prelude Hasql.Pool.ResourcePool exposed-modules: Hasql.Pool- Hasql.Pool.Observer build-depends: -- resources: resource-pool-fork-avanov, -- database:- hasql >= 1.3 && < 1.6,+ hasql >= 1.6.3, -- data: time >= 1.5 && < 2, clock >= 0.8,
library/Hasql/Pool.hs view
@@ -1,7 +1,15 @@+{-| This module represents an extension to 'hasql-pool', it allows for a mix of dynamic credentials+ and static settings for connections in a pool.+ Due to the fact that the module tries to extend 'hasql-pool' rather than rewrite it, the exposed API relies on+ combining existing 'hasql' types with new types, whereas a rewrite would just extend the original types.+ It is done so to simplify maintenance of the extended functionality and make it more compatible with any+ future development of 'hasql-pool'.+-} module Hasql.Pool ( Pool , Settings(..) , UsageError(..)+, ConnectionGetter , acquire , acquireWith , release@@ -22,7 +30,7 @@ -- |--- A pool of connections to DB.+-- A pool of open DB connections. newtype Pool = Pool (ResourcePool.Pool (Either Hasql.Connection.ConnectionError Hasql.Connection.Connection)) deriving (Show)@@ -33,7 +41,8 @@ type ResidenceTimeout = NominalDiffTime -- |--- Connection getter action that allows for obtaining Postgres connection settings via external rsources such as AWS tokens etc.+-- Connection getter action that allows for obtaining Postgres connection settings+-- via external resources such as AWS tokens etc. type ConnectionGetter = IO (Either Hasql.Connection.ConnectionError Hasql.Connection.Connection) -- |@@ -74,7 +83,7 @@ -- |--- Release the connection-pool.+-- Release the connection-pool by closing and removing all connections. release :: Pool -> IO () release (Pool pool) = ResourcePool.destroyAllResources pool@@ -120,8 +129,9 @@ getPoolStats :: Pool -> IO ResourcePool.Stats-getPoolStats (Pool p) = ResourcePool.stats p performStatsReset where- performStatsReset = False+getPoolStats (Pool p) = ResourcePool.stats p performStatsReset+ where+ performStatsReset = False getPoolUsageStat :: Pool -> IO PoolSize
library/Hasql/Pool/Observer.hs view
@@ -7,13 +7,11 @@ import Hasql.Pool.Prelude --- |--- Represents properties of an observed IO action associated with a pool item.+-- | Represents properties of an observed IO action associated with a pool item newtype Observed = Observed { latency :: Rational } deriving (Show) --- |--- You can use this action to send observed attributes to your metrics backend like Prometheus. type ObserverAction = Observed -> IO ()+