scalahub / scaladb   1.0

The Unlicense GitHub

Scala database wrapper

Scala versions: 2.12

ScalaDB

Build Status

ScalaDB is a Scala library for connecting to and querying relational databases. It is created on top of JDBC.

Supported Databases

ScalaDB is extensively tested on H2. It should work with MySQL and PostGreSQL as well, although not heavily tested on those databases.

Examples

Columns can be defined as:

 val STR = VARCHAR(255)
 val name = Col("NAME", STR)
 val age = Col("AGE", INT)
 val sal = Col("SAL", LONG)

Tables can be defined as:

 val users = Tab.withName("USERS").withCols(name, age, sal).withPriKey(name, age) 

Tables can be queried as:

 users.select(name, age).where(sal >= 2000).as(User(_))  

and

 users.aggregate(age.avg).where(sal >= 200).asLong 

More examples here.