Copyright | (c) 2022 Aditya Manthramurthy |
---|---|
License | Apache-2.0 |
Maintainer | Aditya Manthramurthy <aditya.mmy@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
A wai-rate-limit backend using PostgreSQL.
Synopsis
- data PGBackendError
- postgresBackend :: Pool Connection -> Text -> IO (Backend ByteString)
Documentation
data PGBackendError Source #
Represents reasons for why requests made to Postgres backend have failed.
Instances
Eq PGBackendError Source # | |
Defined in Network.Wai.RateLimit.Postgres (==) :: PGBackendError -> PGBackendError -> Bool # (/=) :: PGBackendError -> PGBackendError -> Bool # | |
Show PGBackendError Source # | |
Defined in Network.Wai.RateLimit.Postgres showsPrec :: Int -> PGBackendError -> ShowS # show :: PGBackendError -> String # showList :: [PGBackendError] -> ShowS # | |
Exception PGBackendError Source # | |
Defined in Network.Wai.RateLimit.Postgres |
postgresBackend :: Pool Connection -> Text -> IO (Backend ByteString) 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.