简体   繁体   中英

How can get top of records by GreenDAO?

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM