Created
October 7, 2018 23:57
-
-
Save xcesco/511a057be3c45b556787fd3c77ec016a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@BindDataSourceOptions(populator = AppDataSourcePopulator.class) | |
@BindDataSource(version = 1, | |
daoSet = {CommentDao.class, ProductDao.class}, | |
fileName = "app.db", | |
typeAdapters = { | |
@BindSqlAdapter(adapter = DateMillisecondsTypeAdapter.class)} | |
) | |
public interface AppDataSource { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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