scala-tx-provider

A trait that wraps a code block with a SQL connection

License

License

Categories

Categories

IDE Development Tools Scala Languages
GroupId

GroupId

org.blinkmob
ArtifactId

ArtifactId

scala-tx-provider
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

scala-tx-provider
A trait that wraps a code block with a SQL connection
Project URL

Project URL

https://github.com/gnomff/scala-tx-provider
Source Code Management

Source Code Management

https://github.com/gnomff/scala-tx-provider

Download scala-tx-provider

How to add to project

<!-- https://jarcasting.com/artifacts/org.blinkmob/scala-tx-provider/ -->
<dependency>
    <groupId>org.blinkmob</groupId>
    <artifactId>scala-tx-provider</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.blinkmob/scala-tx-provider/
implementation 'org.blinkmob:scala-tx-provider:1.0.0'
// https://jarcasting.com/artifacts/org.blinkmob/scala-tx-provider/
implementation ("org.blinkmob:scala-tx-provider:1.0.0")
'org.blinkmob:scala-tx-provider:jar:1.0.0'
<dependency org="org.blinkmob" name="scala-tx-provider" rev="1.0.0">
  <artifact name="scala-tx-provider" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.blinkmob', module='scala-tx-provider', version='1.0.0')
)
libraryDependencies += "org.blinkmob" % "scala-tx-provider" % "1.0.0"
[org.blinkmob/scala-tx-provider "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.8
org.scala-lang : scala-compiler jar 2.11.8
com.jsuereth : scala-arm_2.11 jar 1.4

Project Modules

There are no modules declared in this project.

Scala Tx Provider

CxProvider is a trait that grabs a sql connection from a datasource and wraps it in an arm managed resource

Available methods are cx, tx and rbtx. rbtx rolls back the transaction regardless of success or failure.

Example usage:

object DB extends CxProvider with hasDataSource{
    val ds = //yourdatasourcehere
}

DB.tx{implicit c=>
    SQL"""select 1 from stanalone_anorm_is_fun""".as(scalar[Int].single)
}

Gradle Usage:

compile group: 'org.blinkmob', name: 'scala-tx-provider', version: '1.0.0'

Versions

Version
1.0.0