Skip to content

Instantly share code, notes, and snippets.

@markchristopherng
Last active July 4, 2018 04:46
Show Gist options
  • Save markchristopherng/5b0185836278f07a0997009e4db8c3b0 to your computer and use it in GitHub Desktop.
Save markchristopherng/5b0185836278f07a0997009e4db8c3b0 to your computer and use it in GitHub Desktop.
BranchLocationPagingDao
@Dao
interface BranchLocationDao {
@Query("SELECT * from branch_location where postcode like :arg0 OR locality like :arg0 ORDER BY locality ASC")
fun pageByKeyword(arg0: String): DataSource.Factory<Int, BranchLocation>
}
@Singleton
class BranchLocationManager {
@Inject
lateinit var db: IBranchLocationManager
fun pageByKeyword(keyword: String) = db.branchLocationDao().pageByKeyword(keyword + "%")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment