This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Driver | |
trait TestDriver | |
class PostFactory { | |
def hello = "post" | |
} | |
class BlogFactory { | |
def hello = "blog" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a dependency | |
trait Driver { | |
val message: String | |
} | |
trait ProductionDriver extends Driver { | |
val message = "production " | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// our model | |
object model { | |
abstract class X | |
case class A extends X | |
case class B extends X | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{ ActorSystem, Actor, Props } | |
class HelloWorld { | |
def foobar = println(Thread.currentThread().getName()) | |
} | |
object Test { | |
class TestActor(hw: HelloWorld) extends Actor { | |
def receive = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// COMMON-BASE LIBRARY | |
// dependencies | |
trait ConnectionPoolProvider { | |
protected val connectionPool: ConnectionPool | |
} | |
trait ExternalStuff { | |
protected val stuff = "stuff" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.pblue.asyncpools.slick.SlickPoolFactory | |
object MySlickPools extends SlickPoolFactory { | |
val myReadPool = newConfiguredSlickPool("my-read-pool") | |
val myWritePool = newConfiguredSlickPool("my-write-pool") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.slick.driver.H2Driver.simple._ | |
object MyRepository { | |
val table = new Table[(Int, String)]("my_table") { | |
def id = column[Int]("id", O.PrimaryKey) | |
def name = column[String]("name") | |
def * = id ~ name | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.mvc._ | |
import play.api.libs.json.Json | |
import play.api.libs.concurrent.Execution.Implicits.defaultContext | |
object MyController extends Controller { | |
def getName(id: Int) = Action.async { | |
MyRepository.getName(id) | |
.map { name: String => | |
Ok(Json.obj("name" -> name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asyncpools { | |
my-read-pool { | |
size = 5 | |
defaultTimeout = "2 seconds" | |
url = "jdbc:h2:mem:testDB;DATABASE_TO_UPPER=false" | |
user = "" | |
password = "" | |
driver = "org.h2.Driver" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
akka { | |
worker-dispatcher { | |
type = BalancingDispatcher | |
} | |
actor.deployment { | |
"/my-read-pool/*" { | |
dispatcher = akka.worker-dispatcher | |
} | |
} |
OlderNewer