Open skolodyazhnyy opened 10 months ago
maybe you can use raw query as workaround?
var result struct {Sum float64}
sql := rel.SQL("SELECT ....")
err := repo.Find(ctx, &result, sql)
Not really, because result requires primary ID 😄
Finally, after https://github.com/go-rel/primaryreplica/pull/26 got merged, I could make request using sql connection directly. Still would be nice to be able to aggregate on decimal fields.
Aggregate API returns an integer, how do I aggregate a float field?
For instance, I have a decimal price field in my database and I would like to find a sum of all prices:
Instead of getting a sum I'm getting an error
Field price has type
DECIMAL
in MySQL database.