We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As part of supporting aggregate functions add support for following functions:
AVG() SUM()
Add avg and sum tag that can be used in selectClause structs as follows:
avg
sum
selectClause
type TestSoqlStruct struct { SelectClause NestedStruct `soql:"selectClause,tableName= Opportunity"` GroupBy []string `soql:"groupByClause"` } type NestedStruct struct { CampaignId string `soql:"selectColumn,fieldName= CampaignId"` Average int `soql:"avg,fieldName= Amount"` } soqlStruct := TestSoqlStruct{ GroupBy: []string{"CampaignId"}, } soqlQuery, err := Marshal(soqlStruct) if err != nil { fmt.Printf("Error in marshaling: %s\n", err.Error()) } fmt.Println(soqlQuery)
This should result in SOQL as follows
SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId
Note that if fieldName is not specified then return ErrInvalidTag.
fieldName
ErrInvalidTag
Same should apply for sum tag as well.
Allow avg and sum to be used only for supported primitive data types
The text was updated successfully, but these errors were encountered:
No branches or pull requests
As part of supporting aggregate functions add support for following functions:
Add
avg
andsum
tag that can be used inselectClause
structs as follows:This should result in SOQL as follows
Note that if
fieldName
is not specified then returnErrInvalidTag
.Same should apply for
sum
tag as well.Allow
avg
andsum
to be used only for supported primitive data typesThe text was updated successfully, but these errors were encountered: