Skip to content

Latest commit

 

History

History
72 lines (55 loc) · 2.48 KB

README.md

File metadata and controls

72 lines (55 loc) · 2.48 KB

Finagle Postgres

Build status Maven Central Join the chat at https://gitter.im/finagle/finagle-postgres

This library provides PostgreSQL database support for Finagle.

Documentation

See the GitHub Pages

Using the Postgres client

Installation

Finagle Postgres is published on Maven Central. Use the following sbt snippet to bring it as a dependency.

libraryDependencies ++= Seq(
  "io.github.finagle" %% "finagle-postgres" % "0.4.2"
)

Connecting to the DB

val client = Postgres.Client()
  .withCredentials("user", Some("password"))
  .database("dbname")
  .withSessionPool.maxSize(1) //optional; default is unbounded
  .withBinaryResults(true)
  .withBinaryParams(true)
  .withTransport.tls("host")
  .newRichClient("host:port")

Selecting with simple query

val f = client.select("select * from users") {row =>
    User(row.getString("email"), row.getString("name"))
}
logger.debug("Responded " + Await.result(f))

Changelog

See CHANGELOG.md

Contributors

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.