go-rel / go-rel/rel

Aggregate does not allow to get a float (decimal) value

Open
#342 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
786
Forks
61
Avg merge
4d 11h
Merged PRs (30d)
2

Description

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:

```go
total, err := repo.Aggregate(ctx, rel.From("products"), "SUM", "price")
```

Instead of getting a sum I'm getting an error

```
sql: Scan error on column index 0, name "result": converting driver.Value type []uint8 ("1.00000000") to a int64: invalid syntax
```

Field price has type `DECIMAL` in MySQL database.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.