slick

on slick 2.0, I find I can not implicit user defined column

拟墨画扇 提交于 2019-12-13 08:46:20
问题 I use slick 2.0 rc I have defined field UserId : trait TypedId extends Any { def value: Long } trait HasId[ID <: TypedId] { _: Table[_] => def id: Column[ID] } case class UserId(value:Long) extends AnyVal with TypedId case class User(id: Option[UserId], email: String, firstName: String, lastName: String, phone:String) when I use it: class Users(tag: Tag) extends Table[User](tag, "users") with HasId[Option[UserId]] { def * = (id.?, email, firstName , lastName , phone )<> (User.tupled, User

Slick Transactionally future is not invoked in Play for Scala [duplicate]

大兔子大兔子 提交于 2019-12-13 08:20:05
问题 This question already has answers here : Run transactionally and retrieve result in Future (2 answers) Closed 3 years ago . The code below prints '1' and never prints '2', as a result the browser hangs when it requests the page served by the index method. The future is never invoked. If the future.map statement is replaced with Await.result(future, Duration.Inf) the code works correctly. What is the problem? case class UserRole (sk: Int, name: String) class UserRoleDB(tag: Tag) extends Table

Scalac hanging in phase typer

旧巷老猫 提交于 2019-12-13 07:17:38
问题 I am having a problem with 2.10.3 and code generated by Slick (Codegen). It seems very similar to Scalac hanging on phase typer of RegexParser Other files generated by Codegen work, but this one just hangs forever in "scalac: phase typer Foo.scala" The only difference I can see is the number of columns in the table resulting in lots of vals and large cons'ed lists like this def * = WordRootID :: WordID :: WordHeadID :: SynonymID :: PronunciationID :: Rank :: BNCFrequency :: CompassDifficulty

How should one configure Slick to persist tables between sessions?

不羁的心 提交于 2019-12-13 04:41:54
问题 I have experienced some issues while setting up Slick 2.0.2. Any configuration that I do in one session is lost in the next. For example, in the first session, I create the table and add three people: // H2 in-memory database lazy val db = Database.forURL("jdbc:h2:mem:contacts", driver="org.h2.Driver") // Contacts table lazy val contacts = TableQuery[ContactsSchema] // Initial session db withSession { implicit session => contacts.ddl.create // Inserts sample data contacts += Person("John",

Slick button will not work

若如初见. 提交于 2019-12-13 04:29:39
问题 I am following a video tutorial on a java game ( so I can go off from there ) but one of my buttons will not work (exit button). Please Help. I'm using lwjgl and slick. main class: package javagame; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class Game extends StateBasedGame { public static final String gamename = "Java Game Alpha 1.0"; public static final int menu = 0; public static final int play = 1; public Game(String gamename) { super(gamename); this.addState

“Error injecting constructor” when mapping Enumeration using Slick 3.1 with play and scala

守給你的承諾、 提交于 2019-12-13 01:35:11
问题 I have the following classes. please note the commented-out Role lines. user model: case class User( uid: Option[Long] = None, // role: Option[Role.Role] = None, firstName: String, lastName: String, middleName: Option[String] = None, email: String, avatarUrl: Option[String], created: DateTime = DateTime.now, modified: DateTime = DateTime.now ) UserComponent and UserDAO: import javax.inject._ import scala.concurrent.Future import org.krazykat.whatsupdoc.models.User import play.api.db.slick.

Customize slick code generator

我是研究僧i 提交于 2019-12-13 00:39:43
问题 If I have abstract class RichTable[T](tableTag: Tag, name: String) extends Table[T](tableTag, name) { val tenantId: Column[Int] = column[Int]("tenant_id") } And slick generated Table class as follow class Dashboard(_tableTag: Tag) extends Table[DashboardRow](_tableTag, "dashboard") { I want to customize slick code generator to instead generate class Dashboard(_tableTag: Tag) extends RichTable[DashboardRow](_tableTag, "dashboard") { ... override val tenantId: Column[Int] = column[Int]("tenant

Summarizing/aggregating a Scala Slick object into another

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 00:33:32
问题 I'm essentially trying to recreate the following SQL query using Scala Slick: select labelOne, labelTwo, sum(countA), sum(countB) from things where date > 'blah' group by labelOne, labelTwo; As you can see, it takes what a table of labeled things and aggregates them, summing various counts. A table with the following info: ID | date | labelOne | labelTwo | countA | countB ------------------------------------------------- 0 | 0 | foo | cheese | 1 | 2 1 | 0 | bar | wine | 0 | 3 2 | 1 | foo |

Play Framework 2.5.x Scala Slick implementation style

空扰寡人 提交于 2019-12-12 18:13:19
问题 I have kind of philosophical question. I have been a very happy user of Play Framework for Java for couple years now. Now I am trying to dive into Scala and functional programming. In Java-based play I have been using Ebean, so according to Play documentation I extended Ebean Model class and implemented my own models. In each model I declared a static variable of type Finder in order to call queries. All of this is documented and working well. However in Scala-based Play (v2.5.x) there is not

Support of PostgreSQL specific array_agg function in scala frameworks?

♀尐吖头ヾ 提交于 2019-12-12 15:52:11
问题 Is there some scala relational database framework (anorm, squeryl, etc...) using postgres-like aggregators to produce lists after a group-by, or at least simulating its use? I would expect two levels of implementation: a "standard" one, where at least any SQL grouping with array_agg is translated to a List of the type which is being aggregated, and a "scala ORM powered" one where some type of join is allowed so that if the aggregation is a foreign key to other table, a List of elements of the