Skip to content

Instantly share code, notes, and snippets.


joscdk/test.swift Secret

Last active Apr 15, 2020
What would you like to do?
#!/usr/bin/swift sh
import PostgreSQL // ~> 1.0.0
let group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
struct VersionMetadata: Codable {
var version: String
let client = try PostgreSQLConnection.connect(hostname: "localhost", port: 5432, on: group).wait()
_ = try client.authenticate(username: "vapor", database: "test", password: "password").wait()
client.logger = DatabaseLogger(database: .psql, handler: PrintLogHandler())
let results = try"version", [])).all(decoding: VersionMetadata.self).wait()

This comment has been minimized.

Copy link

@mxcl mxcl commented Jan 15, 2019

Could be:

import PostgreSQL  // @vapor ~> 1.0

But either works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment