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
Having a read only field as documented here disallows writing to that field during creation. Is there a reason for this behavior? From my intuition I first thought one could use that field as if it would be immutable. But without the ability to ever store data in that field it renders this feature pretty useless.
In my opinion it is currently nothing else than setting the ignore columns argument globally for every writing operation.
Steps to Reproduce the Problem
typeUserstruct {
ID uuid.UUID`db:"id"`Emailstring`db:"email"`Passwordstring`db:"password" rw:"r"`
}
funcMain() {
connection.Create(&User{
ID: uuid.Must(uuid.NewV4()),
Email: "foo@bar.com",
Password: "this will be ignored",
})
}
Expected Behavior
I would love to be able to write to a "read-only" field on Create.
Actual Behavior
There is no way to write to initialize a "read-only" field. (Except I guess having the same struct twice with different field tags.)
The text was updated successfully, but these errors were encountered:
Having a read only field as documented here disallows writing to that field during creation. Is there a reason for this behavior? From my intuition I first thought one could use that field as if it would be immutable. But without the ability to ever store data in that field it renders this feature pretty useless. In my opinion it is currently nothing else than setting the ignore columns argument globally for every writing operation.
The Model definition is only affected within the application having the Model, but the backing database table could be shared with the other applications such as separated management applications or batch workers/syncers to feed some values which should not be modified or created by the frontend application.
Description
Having a read only field as documented here disallows writing to that field during creation. Is there a reason for this behavior? From my intuition I first thought one could use that field as if it would be immutable. But without the ability to ever store data in that field it renders this feature pretty useless.
In my opinion it is currently nothing else than setting the ignore columns argument globally for every writing operation.
Steps to Reproduce the Problem
Expected Behavior
I would love to be able to write to a "read-only" field on
Create
.Actual Behavior
There is no way to write to initialize a "read-only" field. (Except I guess having the same struct twice with different field tags.)
The text was updated successfully, but these errors were encountered: