Skip to content
A small test project for slick 3.2.0 Milestone and Release Candidate releases
Scala
Branch: master
Clone or download
Latest commit f5bfe8c Feb 24, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
evolutions/src init Dec 20, 2016
pdf ebook Feb 17, 2017
play-slick/src init Dec 20, 2016
project upgraded slick and play Feb 24, 2017
src upgraded slick and play Feb 24, 2017
.gitignore init Dec 20, 2016
README.md profiles Feb 19, 2017
build.sbt upgraded slick and play Feb 24, 2017
version.sbt init Dec 20, 2016

README.md

slick-3.2.0-test

A small test project to test Slick 3.2.0 Release Candidate

Tables, Queries, Actions, Joins and Profiles

Slick isn't that difficult to use but we need to know some concepts so we know how to configure it.

Tables

Tables is how Slick defines a relationship between the Scala datatypes and the database. We need two things, a Scala datatype that we use in our application and a table where to store the data. For example:

case class Album(artist: String, title: String, id: Long = 0)

class AlbumTable(tag: Tag) extends Table[Album](tag, "album") {
	def artist = column[String]("artist")
	def title = column[String]("title")
	def id = column[Long]("id", O.PrimaryKey, O.AutoInc)

    // the default projection of the table
	def * (artist, title, id) <> (Album.tupled, Album.unapply)
}

lazy val AlbumTable = TableQuery[AlbumTable]

Custom Column Mapping

ColumnType typeclass

Queries

A DSL for building SQL

Actions

Actions allow us to sequence queries together and send them to the database in a big scripts.

Joins

Joins allow us to build queries that pull data from multiple sources

Profiles/Drivers

Profiles are slick's way how to represent different database backends with their different capabilities like eg:

  • slick.jdbc.DB2Profile
  • slick.jdbc.DerbyProfile
  • slick.jdbc.H2Profile
  • slick.jdbc.HsqldbProfile
  • slick.jdbc.MySQLProfile
  • slick.jdbc.OracleProfile
  • slick.jdbc.PostgresProfile
  • slick.jdbc.SQLiteProfile
  • slick.jdbc.SQLServerProfile

The idea is that we build generic code that can work with multiple different database backends.

Documentation

Video

Resources

You can’t perform that action at this time.