Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Fixed issues related to 2.1-M2 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object PlainSQL extends App {
where c.price < ? and s.id = c.sup_id
""")
// This time we read the result set into a List
val l2 = q2.list(9.0)
val l2 = q2(9.0).list
for (t <- l2) println(" " + t._1 + " supplied by " + t._2)

// Append to a StaticQuery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DAO(val driver: JdbcProfile) {
def get(k: String)(implicit session: Session): Option[String] =
(for(p <- props if p.key === k) yield p.value).firstOption

def getFirst[M, U](q: Query[M, U])(implicit s: Session) = q.first
def getFirst[M, U](q: Query[M, U, Seq])(implicit s: Session) = q.first
}

/**
Expand All @@ -37,8 +37,8 @@ class DAO(val driver: JdbcProfile) {
class DAOHelper(val d: DAO) {
import d.driver.simple._

def restrictKey(s: String, q: Query[d.Props, (String, String)]):
Query[d.Props, (String, String)] = q.filter(_.key === s)
def restrictKey(s: String, q: Query[d.Props, (String, String),Seq]):
Query[d.Props, (String, String),Seq] = q.filter(_.key === s)
}

/**
Expand Down
22 changes: 11 additions & 11 deletions src/main/scala/com/typesafe/slick/examples/lifted/UseInvoker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ object UseInvoker extends App {
ts.filter(_.k <= k).sortBy(_.k)
}

println("List of k/v pairs up to 3 with .list")
println(" " + upTo(3).list)
//println("List of k/v pairs up to 3 with .list")
//println(" " + upTo(3).list)

println("IndexedSeq of k/v pairs up to 3 with .to")
println(" " + upTo(3).buildColl[IndexedSeq])
//println("IndexedSeq of k/v pairs up to 3 with .buildColl")
//println(" " + upTo(3).buildColl[IndexedSeq])

println("Set of k/v pairs up to 3 with .to")
println(" " + upTo(3).buildColl[Set])
//println("Set of k/v pairs up to 3 with .buildColl")
//println(" " + upTo(3).buildColl[Set])

println("Array of k/v pairs up to 3 with .to")
println(" " + upTo(3).buildColl[Array])
//println("Array of k/v pairs up to 3 with .buildColl")
//println(" " + upTo(3).buildColl[Array])

println("All keys in an unboxed Array[Int]")
val allKeys = ts.map(_.k)
println(" " + allKeys.buildColl[Array]())
//println("All keys in an unboxed Array[Int]")
//val allKeys = ts.map(_.k)
//println(" " + allKeys.buildColl[Array]())
}
}