Skip to content

Commit 37a5035

Browse files
committed
Update to Slick 2.1.0-M1
1 parent 60b8931 commit 37a5035

6 files changed

Lines changed: 16 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/logs/
88
/RUNNING_PID
99
*.iml
10+
.DS_Store

activator.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=hello-slick
2-
title=Hello Slick!
1+
name=hello-slick-2.1
2+
title=Hello Slick! (Slick 2.1)
33
description=Slick is Typesafe's modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can also use SQL directly. This tutorial will get you started with a simple standalone Scala application that uses Slick.
44
tags=Basics,slick,starter

build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name := "hello-slick"
22

33
version := "1.0"
44

5-
scalaVersion := "2.10.3"
5+
scalaVersion := "2.10.4"
66

77
mainClass in Compile := Some("HelloSlick")
88

99
libraryDependencies ++= List(
10-
"com.typesafe.slick" %% "slick" % "2.0.0",
10+
"com.typesafe.slick" %% "slick" % "2.1.0-M1",
1111
"org.slf4j" % "slf4j-nop" % "1.6.4",
1212
"com.h2database" % "h2" % "1.3.170",
13-
"org.scalatest" %% "scalatest" % "2.0" % "test"
13+
"org.scalatest" %% "scalatest" % "2.1.6" % "test"
1414
)

src/main/scala/HelloSlick.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object HelloSlick extends App {
5757
/* Filtering / Where */
5858

5959
// Construct a query where the price of Coffees is > 9.0
60-
val filterQuery: Query[Coffees, (String, Int, Double, Int, Int)] =
60+
val filterQuery: Query[Coffees, (String, Int, Double, Int, Int), Seq] =
6161
coffees.filter(_.price > 9.0)
6262

6363
println("Generated SQL for filter query:\n" + filterQuery.selectStatement)
@@ -69,7 +69,7 @@ object HelloSlick extends App {
6969
/* Update */
7070

7171
// Construct an update query with the sales column being the one to update
72-
val updateQuery: Query[Column[Int], Int] = coffees.map(_.sales)
72+
val updateQuery: Query[Column[Int], Int, Seq] = coffees.map(_.sales)
7373

7474
// Print the SQL for the Coffees update query
7575
println("Generated SQL for Coffees update:\n" + updateQuery.updateStatement)
@@ -83,7 +83,7 @@ object HelloSlick extends App {
8383
/* Delete */
8484

8585
// Construct a delete query that deletes coffees with a price less than 8.0
86-
val deleteQuery: Query[Coffees,(String, Int, Double, Int, Int)] =
86+
val deleteQuery: Query[Coffees,(String, Int, Double, Int, Int), Seq] =
8787
coffees.filter(_.price < 8.0)
8888

8989
// Print the SQL for the Coffees delete query
@@ -98,7 +98,7 @@ object HelloSlick extends App {
9898
/* Selecting Specific Columns */
9999

100100
// Construct a new coffees query that just selects the name
101-
val justNameQuery: Query[Column[String], String] = coffees.map(_.name)
101+
val justNameQuery: Query[Column[String], String, Seq] = coffees.map(_.name)
102102

103103
println("Generated SQL for query returning just the name:\n" +
104104
justNameQuery.selectStatement)
@@ -109,7 +109,7 @@ object HelloSlick extends App {
109109

110110
/* Sorting / Order By */
111111

112-
val sortByPriceQuery: Query[Coffees, (String, Int, Double, Int, Int)] =
112+
val sortByPriceQuery: Query[Coffees, (String, Int, Double, Int, Int), Seq] =
113113
coffees.sortBy(_.price)
114114

115115
println("Generated SQL for query sorted by price:\n" +
@@ -121,7 +121,7 @@ object HelloSlick extends App {
121121

122122
/* Query Composition */
123123

124-
val composedQuery: Query[Column[String], String] =
124+
val composedQuery: Query[Column[String], String, Seq] =
125125
coffees.sortBy(_.name).take(3).filter(_.price > 9.0).map(_.name)
126126

127127
println("Generated SQL for composed query:\n" +
@@ -134,7 +134,7 @@ object HelloSlick extends App {
134134
/* Joins */
135135

136136
// Join the tables using the relationship defined in the Coffees table
137-
val joinQuery: Query[(Column[String], Column[String]), (String, String)] = for {
137+
val joinQuery: Query[(Column[String], Column[String]), (String, String), Seq] = for {
138138
c <- coffees if c.price > 9.0
139139
s <- c.supplier
140140
} yield (c.name, s.name)

src/main/scala/InvokerMethods.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object InvokerMethods extends App {
3838

3939
println("All keys in an unboxed Array[Int]")
4040
val allKeys = dict.map(_.key)
41-
println(" " + allKeys.buildColl[Array]())
41+
println(" " + allKeys.buildColl[Array])
4242

4343
println("Stream k/v pairs up to 3 via an Iterator")
4444
val it = upTo(3).iterator

src/test/scala/TablesSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TablesSuite extends FunSuite with BeforeAndAfter {
2121
test("Creating the Schema works") {
2222
createSchema()
2323

24-
val tables = MTable.getTables().list()
24+
val tables = MTable.getTables.list
2525

2626
assert(tables.size == 2)
2727
assert(tables.count(_.name.name.equalsIgnoreCase("suppliers")) == 1)
@@ -38,7 +38,7 @@ class TablesSuite extends FunSuite with BeforeAndAfter {
3838
test("Query Suppliers works") {
3939
createSchema()
4040
insertSupplier()
41-
val results = suppliers.list()
41+
val results = suppliers.list
4242
assert(results.size == 1)
4343
assert(results.head._1 == 101)
4444
}

0 commit comments

Comments
 (0)