go-gorm / playground

GORM Playground (Please Create PR for this project to report issues)
MIT License
89 stars 678 forks source link

Implement the Valuer/Scanner interface #694

Open alimoli opened 6 months ago

alimoli commented 6 months ago

Explain your user case and expected results

Valuer/Scanner interface is defined for a custom type, but I get the following error: define a valid foreign key for relations or implement the Valuer/Scanner interface

The custom type has a pointer to another type. The test passes if I convert the pointer to just a structure. It seems the problem also affects the anonymous public fields.

[error] invalid field found for struct gorm.io/playground.User's field State: define a valid foreign key for relations or implement the Valuer/Scanner interface
2024/05/29 12:01:59 Failed to drop table, got error invalid field found for struct gorm.io/playground.User's field State: define a valid foreign key for relations or implement the Valuer/Scanner interface
exit status 1