Type Method
mysql(hostname:port:username:password:database:tlsConfiguration:maxConnectionsPerEventLoop:connectionPoolTimeout:pruneInterval:maxIdleTimeBeforePruning:encoder:decoder:sqlLogLevel:)
static func mysql(hostname: String, port: Int = 3306, username: String, password: String, database: String? = nil, tlsConfiguration: TLSConfiguration? = .makeClientConfiguration(), maxConnectionsPerEventLoop: Int = 1, connectionPoolTimeout: TimeAmount = .seconds(10), pruneInterval: TimeAmount?, maxIdleTimeBeforePruning: TimeAmount = .seconds(120), encoder: MySQLDataEncoder = .init(), decoder: MySQLDataDecoder = .init(), sqlLogLevel: Logger.Level? = .debug) -> DatabaseConfigurationFactory
Parameters
hostnameThe hostname to connect to.
portA TCP port number to connect on. Defaults to the IANA-assigned MySQL port number (3306).
usernameThe username to use for the connection.
passwordThe password (empty string for none) to use for the connection.
databaseThe default database for the connection, if any.
tlsConfigurationAn optional
TLSConfigurationspecifying encryption for the connection.maxConnectionsPerEventLoopThe maximum number of database connections to add to each event loop’s pool.
connectionPoolTimeoutThe timeout for queries on the connection pool’s wait list.
pruneIntervalHow often to check for and prune idle database connections. If
nil(the default), no pruning is performed.maxIdleTimeBeforePruningHow long a connection may remain idle before being pruned, if pruning is enabled. Defaults to 2 minutes. Ignored if
pruneIntervalisnil.encoderA
MySQLDataEncoderused to translate bound query parameters intoMySQLDatavalues.decoderA
MySQLDataDecoderused to translateMySQLDatavalues into output values inSQLRows.sqlLogLevelThe log level to use for logging serialized queries issued to databases using this configuration.
Return Value
An appropriate configuration factory.