Open atulkc opened 4 years ago
As a workaround i have been using something like this:-
type TestSoqlStruct struct {
SelectClause struct {
Count string `soql:"selectColumn,fieldName=COUNT()"`
} `soql:"selectClause,tableName=Account"`
WhereClause TestQueryCriteria `soql:"whereClause`
}
Response: {"totalSize":1,"done":true,"records":[]}
As part of supporting aggregate functions add support for following functions:
Add
count
andcountDistinct
tag that can be used inselectClause
structs as follows:This should result in SOQL as follows
Note that if
fieldName
is not specified then justCOUNT()
should be used. IffieldName
is specified then that should be used.Same should apply for
countDistinct
tag as well.Note that if
count
orcountDistinct
is used withoutfieldName
then there cannot be any other field in select clause as described here. IfgroupBy
clause is used only then allow selectClause struct to have other fields. In case of error returnErrInvalidCountTag
error.Allow
count
andcountDistinct
to be used only for supported primitive data types