Skip to content

Type Method

mysql(unixDomainSocketPath:username:password:database:maxConnectionsPerEventLoop:connectionPoolTimeout:pruneInterval:maxIdleTimeBeforePruning:encoder:decoder:sqlLogLevel:)

Create a database configuration factory for connecting to a server through a UNIX domain socket.
static func mysql(unixDomainSocketPath: String, username: String, password: String, database: String? = nil, maxConnectionsPerEventLoop: Int = 1, connectionPoolTimeout: TimeAmount = .seconds(10), pruneInterval: TimeAmount?, maxIdleTimeBeforePruning: TimeAmount = .seconds(120), encoder: MySQLDataEncoder = .init(), decoder: MySQLDataDecoder = .init(), sqlLogLevel: Logger.Level? = .debug) throws -> DatabaseConfigurationFactory

Parameters

unixDomainSocketPath

The path to the UNIX domain socket to connect through.

username

The username to use for the connection.

password

The password (empty string for none) to use for the connection.

database

The default database for the connection, if any.

maxConnectionsPerEventLoop

The maximum number of database connections to add to each event loop’s pool.

connectionPoolTimeout

The timeout for queries on the connection pool’s wait list.

pruneInterval

How often to check for and prune idle database connections. If nil (the default), no pruning is performed.

maxIdleTimeBeforePruning

How long a connection may remain idle before being pruned, if pruning is enabled. Defaults to 2 minutes. Ignored if pruneInterval is nil.

encoder

A MySQLDataEncoder used to translate bound query parameters into MySQLData values.

decoder

A MySQLDataDecoder used to translate MySQLData values into output values in SQLRows.

sqlLogLevel

The log level to use for logging serialized queries issued to databases using this configuration.

Return Value

An appropriate configuration factory.