Swiftpack.co - Package - SwifQL/MySQLBridge

MIT License Swift 5.2 Github Actions Swift.Stream

Bridge to MySQL

Work with MySQL with SwifQL through its pure NIO driver.


.package(url: "https://github.com/SwifQL/MySQLBridge.git", from:"1.0.0-rc"),
.package(url: "https://github.com/SwifQL/VaporBridges.git", from:"1.0.0-rc"),
.target(name: "App", dependencies: [
    .product(name: "Vapor", package: "vapor"),
    .product(name: "MySQLBridge", package: "MySQLBridge"),
    .product(name: "VaporBridges", package: "VaporBridges")

For more info please take a look at the Bridges repo.


Stars: 0

Used By

Total: 0


🏀 Implement `requestConnection` method - 2020-06-06 13:41:38

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.*)
                      .execute(on: connection)
                      .all(decoding: User.self)

// 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.