agrosner / DBFlow

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.
MIT License
4.87k stars 598 forks source link

How to add condition for Method #1706

Closed Momohanfeng closed 3 years ago

Momohanfeng commented 4 years ago

ISSUE_TEMPLATE

DBFlow Version: all versions Bug or Feature Request: Feature Description: I want to excute sql code like select max(timeStamp), count(isRead = 1 or null) as unRead, * from MessageInfo group by userId

but the Method.count or other function only accept IProperty, how to implement the sql on DBFlow? thanks

agrosner commented 3 years ago
select max(timeStamp), count(isRead = 1 or null) as unRead, * from MessageInfo group by userId

something like this?

select(max(timeStamp), count(propertyString<Any>("isRead = 1 or NULL")).as("unRead"), Property.ALL_PROPERTY) from MessageInfo::class groupBy MessageInfo.userId