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.
link |
Stars: 2 |
Last commit: 12 weeks ago |
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.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics