Thanks to visit codestin.com
Credit goes to github.com

Skip to content

jilen/finagle-postgres

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finagle Postgres

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

This library provides PostgreSQL database support for Finagle.

Using the Postgres client

Installation

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

  • for the stable release:
libraryDependencies ++= Seq(
  "com.github.finagle" %% "finagle-postgres" % "0.2.0"
)
  • for the SNAPSHOT version:
resolvers += Resolver.sonatypeRepo("snapshots")

libraryDependencies ++= Seq(
  "com.github.finagle" %% "finagle-postgres" % "0.2.1-SNAPSHOT" changing()
)

Connecting to the DB

val client = Client(
  host = "host:port",
  username = "user",
  password = Some("password"),
  database = "dbname",
  useSsl = false,             // Optional - defaults to `false`
  hostConnectionLimit = 1,    // Optional - defaults to `1`
  numRetries = 4,             // Optional - defaults to `4`
  customTypes = false,        // Optional - defaults to `false
  customReceiveFunctions = {  // Optional - defaults to no-op partial function
    case "mytyperecv" => ValueDecoder.instance(str => ???, (buf, charset) => ???)
  },
  binaryResults = false,      // Optional - defaults to `false`
  binaryParams = false        // Optional - defaults to `false`
)

Selecting with simple query

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

Changelog

See CHANGELOG.md

History

Finagle-postgres was originally developed by Mairbek Khadikov, with subsequent work by The Factory, Vladimir Kostyukov, and others. In early 2015 Twitter began using the library, and this repository reflects the most recent changes (as of March 2015) from The Factory's fork together with changes from Twitter's internal fork (including new SSL support).

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.

About

PostgreSQL protocol support for Finagle

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%