How to return a Rx Single transaction using Room Db?
问题 Suppose there is a Dao class with the following two methods: 1) delete(items: List<Item>): Completable 2) insert(items: List< Item >): Single<List<Long>> How can I chain them into a @transaction method in Dao class starting with ‘delete method’ and then returning ‘insert method’ result? I want to have a method with a signature like this: @Transaction fun deleteAndInsert(): Single<List<Long> > { ... } 回答1: I'm assuming your main goal is to have the return type of deleteAndInsert() as Single .