Skip to content

Instantly share code, notes, and snippets.

@markchristopherng
Created April 11, 2018 04:08
Show Gist options
  • Save markchristopherng/5b17c9826e048105e7bf8d31b06d73b8 to your computer and use it in GitHub Desktop.
Save markchristopherng/5b17c9826e048105e7bf8d31b06d73b8 to your computer and use it in GitHub Desktop.
BranchLocationDao
package au.com.auspost.android.feature.postcode.service
import android.arch.persistence.room.Dao
import android.arch.persistence.room.Insert
import android.arch.persistence.room.OnConflictStrategy
import android.arch.persistence.room.Query
import au.com.auspost.android.feature.postcode.model.BranchLocation
import io.reactivex.Single
@Dao
interface BranchLocationDao {
@Query("SELECT * from branch_location ORDER BY locality ASC")
fun getAll() : Single<List<BranchLocation>>
@Query("SELECT * from branch_location where postcode like :keyword OR locality like :keyword ORDER BY locality ASC")
fun getByKeyword(keyword : String) : Single<List<BranchLocation>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(branchLocation: BranchLocation)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment