Skip to content

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

Description

@skolodyazhnyy

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:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions