Skip to content

Instantly share code, notes, and snippets.

@sullivan-
Created December 15, 2014 16:41
Show Gist options
  • Save sullivan-/8b81f41d9d6797f8f20c to your computer and use it in GitHub Desktop.
Save sullivan-/8b81f41d9d6797f8f20c to your computer and use it in GitHub Desktop.
trait AuthRepo {
def create(auth: Author): AuthId
def retrieve(id: AuthId): Author
def update(auth: Author): Unit
def delete(auth: Author): Unit
}
class AuthRepoImpl extends AuthRepo {
def create(auth: Author) = println(s"create $auth")
def retrieve(id: AuthId) = {
println(s"retrieve $id")
new Author
}
def update(auth: Author) = println(s"update $auth")
def delete(auth: Author) = println(s"delete $auth")
}
trait AuthServ {
def create(auth: Author): AuthId
def retrieve(id: AuthId): Author
def update(auth: Author): Unit
def delete(auth: Author): Unit
}
class AuthServImpl(authRepo: AuthRepo) extends AuthServ {
def create(auth: Author) = authRepo.create(auth)
def retrieve(id: AuthId) = authRepo.retrieve(id)
def update(auth: Author) = authRepo.update(auth)
def delete(auth: Author) = authRepo.delete(auth)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment