Coder Social home page Coder Social logo

finagle-postgres's Introduction

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.

finagle-postgres's People

Contributors

mairbek avatar scala-steward avatar leonmaia avatar jeremyrsmith avatar vkostyukov avatar dangerousben avatar crispywalrus avatar ben-healthforge avatar andrerigon avatar matterkkila avatar vcherkassky avatar plaflamme avatar travisbrown avatar jilen avatar tberman avatar yolken avatar clhodapp avatar justin-factory avatar juliano avatar steveniemitz avatar afine avatar fabianhjr avatar taion809 avatar gitter-badger avatar golem131 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.