Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | me@jspha.com |
Safe Haskell | None |
Heroku-style database connection URL parsing.
- data DBConnection = DBConnection {
- provider :: Provider
- host :: ByteString
- username :: ByteString
- password :: ByteString
- port :: Int
- location :: ByteString
- params :: Map ByteString ByteString
- data Provider
- = Postgres ByteString
- | MySQL ByteString
- | AMQP ByteString
- | HTTP ByteString
- | Other ByteString
- providerString :: Provider -> ByteString
Documentation
data DBConnection Source
A type representing the information that can be parsed from a URL-style database configuration. For example consider the following URLs
postgres://user3123:passkja83kd8@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398 mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true mysql2://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true http://user:pass@instance.ip/resourceid amqp://user:pass@ec2.clustername.cloudamqp.com/vhost
We assume that all the information in these URLs is provided---if a username or password is unnecessary then it must be passed as an empty string and not omitted.
DBConnection | |
|
Provider indicates what kind of database provider scheme this URL
refers to. This provides a small amount of convenience around URL
detection, but if detection fails use providerName
to extract the raw
string.