Swiftpack.co -  Package - mlilback/pgswift
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
mlilback/pgswift
Postgresql driver for swift that only depends on libpq and apple/swift-log
.package(url: "https://github.com/mlilback/pgswift.git", from: "v0.1.2")

pgswift

Swift 5.0 License: ISC platforms: macOS  | Linux

A PostgreSQL driver for use in swift. Requires Swift 5.0+. Builds with Swift Package Manager. It depends on libpq being available, but the package manager knows how install that vai brew/apt-get.

Every other driver I've seen requires as associated ORM system. I just want raw calls to postgresql.

Update

Vapor has a new package using swift-nio, but I'm in no poisition to switch right now. So I'll keep working on this until I have time to experiment with the Vapor package.

This is being actively developed. Not even close to a release, though it has enough basic features to use in a Kitura app I'm building.

The one feature that sets it apart from the other libraries (to me) is support for notifications (LISTEN/NOTIFY) using a DispatchQueue — the only other implementation I've seen uses polling!

Testing

XCTest is used, but they are integration/system tests, not unit tests. Since all of the code deals with a remote database, writing mocks would insanely difficult. There is a shell script that starts up a docker container. The test will fatal error if the pgtest container is not available.

If docker is not located at /usr/local/bin/docker on your systerm, specify the path in the DOCKER_EXE environment variable before running the tests.

The tests are very comprehensive. Most code not covered is error handling from the database or network that are not reproducible.

Continuous Integration

CircleCI doesn't support macOS. Travis doesn't support using docker containers on macOS. That means no CI.

Documentation

API documentation is enerated using jazzy. It uses Ruby, so I'd highly recommend using rbenv instead of the system Ruby since the syystem Ruby is old and deprectated in Catalina. And you'd have to use sudo to install it in system directories.

GitHub

link
Stars: 0
Last commit: 5 weeks ago

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco