You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I debugged gorm and found that only exported struct fields get mapped, so after renaming the field to Name instead of name, it works.
If I search for export in the docs, I cannot find anything that says fields must be exported in order to be mapped.
That link almost implies that it isn't necessary to make them exported:
Exported fields have all permissions when doing CRUD with GORM, and GORM allows you to change the field-level permission with tag, so you can make a field to be read-only, write-only, create-only, update-only or ignored
Could we add something to the docs to make it really clear that the fields need to be exported?
GORM Playground Link
go-gorm/playground#768
Description
I have a column in the database named NAME and in the struct I want to call it myName, so I have this struct:
but when I read a row, the struct attribute myName is never filled
I added a new test to the playground here
it fails with this output:
(please note that I updated
gen.go
in my pull request due to go-gorm/playground#751 - this is not relevant for the problem I am reporting here)The text was updated successfully, but these errors were encountered: