문제

I wanna to get top some records from my table, but GreenDAO doesn't provide it. Like this:

SELECT TOP 1 * FROM table_name

In LINQ you can get top of records with Take(), is there any solution for GreenDAO?

Could every one offer a suggestion?

도움이 되었습니까?

해결책

You can specify a limit using standard QueryBuilder:

List<YourEntity> entities = yourDao.queryBuilder().limit(1).list();

다른 팁

 var mcc: SearchDao
      
 val list: List<Search?> =mcc.queryBuilder().orderDesc(SearchDao.Properties.Time).limit(8).list()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top