Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Main {
- class Users(tag: Tag) extends Table[(Int, String, String)](tag, "users") {
- def id = column[Int]("id")
- def username = column[String]("username")
- def miestas = column[String]("miestas")
- def * = (id, username, miestas)
- }
- def main(args: Array[String]): Unit = {
- val connectionUrl = "jdbc:postgresql://localhost/test?user=postgres&password=kurmis"
- Database.forURL(connectionUrl, driver = "org.postgresql.Driver") withSession {
- implicit session =>
- val users = TableQuery[Users]
- for (a <- 1 to 10) {
- val r = scala.util.Random
- users.map(_.username) += r.nextInt.toString
- }
- //Insert
- val r = scala.util.Random
- users.map(_.username) += r.nextInt.toString
- println("pabandom")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement