go-rel / rel

:gem: Modern ORM for Golang - Testable, Extendable and Crafted Into a Clean and Elegant API
https://go-rel.github.io/
MIT License
744 stars 58 forks source link

converting argument: unsupported type #347

Closed fairking closed 8 months ago

fairking commented 8 months ago

Hi everyone,

I have the following entity:

type Base struct {
    Id string
}

type Audited struct {
    Base
    CreatedAt time.Time
    UpdatedAt time.Time
}

type Contact struct {
    Audited
    Name      string
}

When I try to update it:

contact.Name = "John Smith"
err = srv.db.Repo().Update(*srv.ctx.ctx, &contact)

I have got the following error:

sql: converting argument $4 type: unsupported type entities.Base, a struct

Instrumentation:

UPDATE "contacts" SET "name"=?,"created_at"=?,"updated_at"=? WHERE "contacts"."id"=?;, [[John Smith 2023-10-16 23:41:35.5785051 +0000 UTC 2023-10-17 01:41:52 +0200 CEST {Id:koo46y1vtrnf74k2}]]