RxJava - как в ViewModel передать метод из Репозитория в LiveData и указать потоки
In Dao:
@Query("SELECT * FROM person_table WHERE status = :status_debil ORDER BY RANDOM() LIMIT 5")
Single<List<Person>> getFivePersonsFrom(String status_debil);
In Repo:
public class PersonRepository {
public Single<List<Person>> getFivePersonsFrom(String status_debil) {
return mPersonDao.getFivePersonsFrom(status_debil);
}
}
In ViewModel:
public class PersonViewModel extends AndroidViewModel {
private PersonRepository mRepository;
//declaring variables
public PersonViewModel(@NonNull Application application) {
super(application);
mRepository = new PersonRepository(application);
//initializing variables
}
//methods
}
Что и где мне нужно написать в ViewModel, чтобы дернуть метод из Репозитория (и указать второстепенный поток) и передать ответ в LiveData?