This library provides PostgreSQL database support for Finagle.
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
SNAPSHOTversion:
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies ++= Seq(
"com.github.finagle" %% "finagle-postgres" % "0.2.1-SNAPSHOT" changing()
)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`
)val f = client.select("select * from users") {row =>
User(row.getString("email"), row.getString("name"))
}
logger.debug("Responded " + f.get)See CHANGELOG.md
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).
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.