Skip to content

Instantly share code, notes, and snippets.

@shkschneider
Last active November 29, 2018 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shkschneider/d0eecde25b37ca28ba24493a3be4f547 to your computer and use it in GitHub Desktop.
Save shkschneider/d0eecde25b37ca28ba24493a3be4f547 to your computer and use it in GitHub Desktop.
object DataManager {
@WorkerThread
fun dummy(context: Context) {
with(MyDatabase.get(context)) {
users().insert(User(login = "user.name"))
projects().insert(Project(name = "project.name"))
notifications().insert(Notification(msg = "created"))
}
}
@WorkerThread
fun getUsers(context: Context): List<User> =
MyDatabase.get(context).users().getAll()
@WorkerThread
fun getProjects(context: Context): List<Project> =
MyDatabase.get(context).projects().getAll()
@WorkerThread
fun getNotifications(context: Context): List<Notification> =
MyDatabase.get(context).notifications().getAll()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment