Skip to content

Instantly share code, notes, and snippets.

@renaudmathieu
Created July 5, 2021 15:18
Show Gist options
  • Save renaudmathieu/e2bd271b781dc05e50b97a23204234e8 to your computer and use it in GitHub Desktop.
Save renaudmathieu/e2bd271b781dc05e50b97a23204234e8 to your computer and use it in GitHub Desktop.
ktor_part3_TodoRepositoryImpl
class TodoRepositoryImpl: TodoRepository {
override suspend fun create(todo: Todo): Todo = newSuspendedTransaction{
TodoModel.new{
subject = todo.subject
done = todo.done
}.toEntity()
}
override suspend fun getAll(): List<Todo> = newSuspendedTransaction{
TodoModel.all().map(TodoModel::toEntity)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment