Safe Haskell | None |
---|---|
Language | Haskell98 |
A MySQL backend for persistent
.
- withMySQLPool :: (MonadIO m, MonadLogger m, MonadBaseControl IO m, IsSqlBackend backend) => MySQLConnectInfo -> Int -> (Pool backend -> m a) -> m a
- withMySQLConn :: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend backend) => MySQLConnectInfo -> (backend -> m a) -> m a
- createMySQLPool :: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend backend) => MySQLConnectInfo -> Int -> m (Pool backend)
- module Database.Persist.Sql
- data MySQLConnectInfo
- mkMySQLConnectInfo :: HostName -> ByteString -> ByteString -> ByteString -> MySQLConnectInfo
- setMySQLConnectInfoPort :: PortNumber -> MySQLConnectInfo -> MySQLConnectInfo
- setMySQLConnectInfoCharset :: Word8 -> MySQLConnectInfo -> MySQLConnectInfo
- data MySQLConf
- mkMySQLConf :: MySQLConnectInfo -> Int -> MySQLConf
- mockMigration :: Migration -> IO ()
- setMySQLConnectInfoTLS :: ClientParams -> MySQLConnectInfo -> MySQLConnectInfo
- data TrustedCAStore :: *
- makeClientParams :: TrustedCAStore -> IO ClientParams
- makeClientParams' :: FilePath -> [FilePath] -> FilePath -> TrustedCAStore -> IO ClientParams
Documentation
:: (MonadIO m, MonadLogger m, MonadBaseControl IO m, IsSqlBackend backend) | |
=> MySQLConnectInfo | Connection information. |
-> Int | Number of connections to be kept open in the pool. |
-> (Pool backend -> m a) | Action to be executed that uses the connection pool. |
-> m a |
Create a MySQL connection pool and run the given action.
The pool is properly released after the action finishes using
it. Note that you should not use the given ConnectionPool
outside the action since it may be already been released.
:: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend backend) | |
=> MySQLConnectInfo | Connection information. |
-> (backend -> m a) | Action to be executed that uses the connection. |
-> m a |
Same as withMySQLPool
, but instead of opening a pool
of connections, only one connection is opened.
:: (MonadBaseControl IO m, MonadIO m, MonadLogger m, IsSqlBackend backend) | |
=> MySQLConnectInfo | Connection information. |
-> Int | Number of connections to be kept open in the pool. |
-> m (Pool backend) |
Create a MySQL connection pool. Note that it's your
responsibility to properly close the connection pool when
unneeded. Use withMySQLPool
for automatic resource control.
module Database.Persist.Sql
:: HostName | hostname |
-> ByteString | username |
-> ByteString | password |
-> ByteString | database |
-> MySQLConnectInfo |
Public constructor for MySQLConnectInfo
.
setMySQLConnectInfoPort :: PortNumber -> MySQLConnectInfo -> MySQLConnectInfo Source #
Update port number for MySQLConnectInfo
.
setMySQLConnectInfoCharset Source #
:: Word8 | Numeric ID of collation. See https://dev.mysql.com/doc/refman/5.7/en/show-collation.html. |
-> MySQLConnectInfo | Reference connectInfo to perform update on |
-> MySQLConnectInfo |
Update character set for MySQLConnectInfo
.
Information required to connect to a MySQL database
using persistent
's generic facilities. These values are the
same that are given to withMySQLPool
.
:: MySQLConnectInfo | The connection information. |
-> Int | How many connections should be held on the connection pool. |
-> MySQLConf |
Public constructor for MySQLConf
.
mockMigration :: Migration -> IO () Source #
Mock a migration even when the database is not present. This function will mock the migration for a database even when the actual database isn't already present in the system.
TLS configuration
setMySQLConnectInfoTLS Source #
:: ClientParams |
|
-> MySQLConnectInfo | Reference connectInfo to perform update on |
-> MySQLConnectInfo |
Set TLS ClientParams for MySQLConnectInfo
.
data TrustedCAStore :: * #
The whole point of TLS is that: a peer should have already trusted
some certificates, which can be used for validating other peer's certificates.
if the certificates sent by other side form a chain. and one of them is issued
by one of TrustedCAStore
, Then the peer will be trusted.
SystemCAStore | provided by your operating system. |
MozillaCAStore | provided by Mozilla. |
CustomCAStore FilePath | provided by your self, the CA file can contain multiple certificates. |
:: TrustedCAStore | trusted certificates. |
-> IO ClientParams |
make a simple tls ClientParams
that will validate server and use tls connection
without providing client's own certificate. suitable for connecting server which don't
validate clients.
we defer setting of clientServerIdentification
to connecting phase.
Note, tls's default validating method require server has v3 certificate.
you can use openssl's V3 extension to issue such a certificate. or change ClientParams
before connecting.
:: FilePath | public certificate (X.509 format). |
-> [FilePath] | chain certificates (X.509 format). the root of your certificate chain should be already trusted by server, or tls will fail. |
-> FilePath | private key associated. |
-> TrustedCAStore | trusted certificates. |
-> IO ClientParams |
make a simple tls ClientParams
that will validate server and use tls connection
while providing client's own certificate as well. suitable for connecting server which
validate clients.
Also only accept v3 certificate.