The error occurs when one or more rows should be found in the database.
Works fine with go v1.20.x
Simplified example:
type ID uint
type Auth struct {
Id ID `db:"id,primary"`
AuthRoles []AuthRoles `ref:"id" fk:"auth_id"`
}
func (s Auth) Table() string {
return "auth"
}
type AuthRoles struct {
AuthId ID `db:"auth_id,primary"`
RoleId ID `db:"role_id,primary"`
}
func (s AuthRoles) Table() string {
return "auth_roles"
}
var a &Auth
err := repo.Find(context.Background(), a, where.Eq("xxx", xxx))
if err != nil {
panic(err)
}
err = repo.Preload(context.Background(), a, "auth_roles")
if err != nil {
panic(err)
}
Since go v1.21.0
Preload()
fails with the following error on following code lines of rel. (With go v1.20.x all works fine.)err = sql: Scan called without calling Next (closemuScanHold)
https://github.com/go-rel/rel/blob/v0.39.0/cursor.go#L104 https://github.com/go-rel/rel/blob/v0.39.0/repository.go#L1068Simplified example: