Skip to content

Releases: SwifQL/MySQLBridge

🏀 Implement `requestConnection` method

06 Jun 13:41
2e9988f
Compare
Choose a tag to compare

Thanks to @YorkFieldX now we can use MySQLConnection in tests simply this way

// retrieve a connection
let connection = try application.mysql.requestConnection(to: .my_awesome_database).wait()

// execute any queries
let users = try SwifQL.select(User.table.*)
                      .from(User.table)
                      .execute(on: connection)
                      .all(decoding: User.self)
                      .wait()

// don't forget to close a connection
try connection.close().wait()

⚠️Use this way only in tests cause you can only close a connection but not return it back to a pool, so it may affect app performance.