| Copyright | (c) 2022 Aditya Manthramurthy |
|---|---|
| License | Apache-2.0 |
| Maintainer | Aditya Manthramurthy <[email protected]> |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Wai.RateLimit.Postgres
Description
A wai-rate-limit backend using PostgreSQL.
Synopsis
- data PGBackendError
- postgresBackend :: Pool Connection -> Text -> IO (Backend ByteString PGBackendError)
Documentation
data PGBackendError Source #
Represents reasons for why requests made to Postgres backend have failed.
Constructors
Instances
| Eq PGBackendError Source # | |
Defined in Network.Wai.RateLimit.Postgres Methods (==) :: PGBackendError -> PGBackendError -> Bool # (/=) :: PGBackendError -> PGBackendError -> Bool # | |
| Show PGBackendError Source # | |
Defined in Network.Wai.RateLimit.Postgres Methods showsPrec :: Int -> PGBackendError -> ShowS # show :: PGBackendError -> String # showList :: [PGBackendError] -> ShowS # | |
| Exception PGBackendError Source # | |
Defined in Network.Wai.RateLimit.Postgres Methods toException :: PGBackendError -> SomeException # | |
postgresBackend :: Pool Connection -> Text -> IO (Backend ByteString PGBackendError) Source #
Initialize a postgres backend for rate-limiting. Takes a connection pool and table name to use for storage. The table will be created if it does not exist. A thread is also launched to periodically clean up expired rows from the table.