This file contains hidden or 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
// kinja-service library | |
class SsoService extends ApiService { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} | |
} | |
trait SsoServiceContract { | |
This file contains hidden or 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
// kinja-service library | |
class SsoService extends ApiService { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} | |
} | |
case class AuthorByToken(token: String) |
This file contains hidden or 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
// kinja-service library | |
class SsoService extends ApiService { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} | |
} | |
class InvitesService extends Service { | |
def invite(token: String, invitee: Author, authorResolver: String => Author): Unit = { |
This file contains hidden or 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
// kinja-service library | |
trait SsoServiceComponent extends ServiceComponent { | |
val ssoService: SsoService | |
class SsoService extends Service { | |
def authorByToken(token: String): Author = { | |
lookupAuthorInDatabase(token) | |
} |
This file contains hidden or 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 | |
} | |
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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" |