Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@BindDataSourceOptions(populator = AppDataSourcePopulator.class)
@BindDataSource(version = 1,
daoSet = {CommentDao.class, ProductDao.class},
fileName = "app.db",
typeAdapters = {
@BindSqlAdapter(adapter = DateMillisecondsTypeAdapter.class)}
)
public interface AppDataSource {
}
@BindDao(ProductEntity.class)
public interface ProductDao extends AbstractDao<ProductEntity> {
@BindSqlSelect(orderBy = "name")
MutableLiveData<List<ProductEntity>> loadAllProducts();
@BindSqlSelect(where = "id = :productId")
MutableLiveData<ProductEntity> loadProduct(long productId);
@BindSqlSelect(where = "id = :productId")
ProductEntity loadProductSync(long productId);
@BindSqlSelect(orderBy = "name", pageSize = 1)
ProductEntity selectFirst();
@BindSqlDelete(where = "id=:{bean.id}")
int delete(ProductEntity bean);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment