You can make the Dao as an abstract class, the actual saving is where you run the query, but you call it from another method.
@Dao
public abstract class UserDao {
public void insert(User user){
if(yourCondition){
insertInternal(user);
}
}
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertInternal(User user);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…