finagle-postgres


License

License

GroupId

GroupId

io.github.finagle
ArtifactId

ArtifactId

finagle-postgres_2.11
Last Version

Last Version

0.12.0
Release Date

Release Date

Type

Type

jar
Description

Description

finagle-postgres
finagle-postgres
Project URL

Project URL

https://finagle.github.io/finagle-postgres
Project Organization

Project Organization

io.github.finagle
Source Code Management

Source Code Management

https://github.com/finagle/finagle-postgres

Download finagle-postgres_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.finagle/finagle-postgres_2.11/ -->
<dependency>
    <groupId>io.github.finagle</groupId>
    <artifactId>finagle-postgres_2.11</artifactId>
    <version>0.12.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.finagle/finagle-postgres_2.11/
implementation 'io.github.finagle:finagle-postgres_2.11:0.12.0'
// https://jarcasting.com/artifacts/io.github.finagle/finagle-postgres_2.11/
implementation ("io.github.finagle:finagle-postgres_2.11:0.12.0")
'io.github.finagle:finagle-postgres_2.11:jar:0.12.0'
<dependency org="io.github.finagle" name="finagle-postgres_2.11" rev="0.12.0">
  <artifact name="finagle-postgres_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.finagle', module='finagle-postgres_2.11', version='0.12.0')
)
libraryDependencies += "io.github.finagle" % "finagle-postgres_2.11" % "0.12.0"
[io.github.finagle/finagle-postgres_2.11 "0.12.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
com.twitter : finagle-core_2.11 jar 19.9.0
com.twitter : finagle-netty4_2.11 jar 19.9.0

test (4)

Group / Artifact Type Version
org.scalatest : scalatest_2.11 jar 3.0.8
org.scalacheck : scalacheck_2.11 jar 1.14.0
org.scalamock : scalamock-scalatest-support_2.11 jar 3.6.0
io.circe : circe-testing_2.11 jar 0.11.1

Project Modules

There are no modules declared in this project.

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.12.0"
)

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))

Integration Tests

sbt test won't run integration tests by default. In order to make it easier for development, a database environment is provided via Docker. After installing Docker and docker compose, run:

docker-compose up -d

A few environment variables need to be provided as well:

export PG_HOST_PORT=localhost:5432 PG_DBNAME=finagle_postgres_test PG_USER=postgres

With the database and variables in place, all tests will be executed. More details in IntegrationSpec

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.

io.github.finagle

Finagle

Finagle ecosystem projects

Versions

Version
0.12.0
0.11.0
0.10.0
0.9.0
0.8.3
0.8.2
0.8.0
0.7.0
0.6.0
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.2
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0