Conversation
spanner/value.go
Outdated
| name = parts[0] | ||
| tag := spannerTag{} | ||
| for _, part := range parts[1:] { | ||
| if part == "generated" { |
There was a problem hiding this comment.
As mentioned above; Should we consider using readOnly instead for this? Or is there prior art / precedence from other databases or frameworks that indicate that generated is a more common term?
There was a problem hiding this comment.
If we talk about GORM they support something like
Name string `gorm:"->"` // readonly (disable write permission unless it configured)
There was a problem hiding this comment.
Updated PR to use readOnly as well as how GORM parses this ->
| parts := strings.Split(s, ",") | ||
| name = parts[0] | ||
| tag := spannerTag{} | ||
| for _, part := range parts[1:] { |
There was a problem hiding this comment.
Why do we skip the first result here? Is it because it should always be parsed as the column name?
Can we add some documentation (code comments) that explains what can go into this tag, and how it should be used (including this new tag)?
There was a problem hiding this comment.
Why do we skip the first result here? Is it because it should always be parsed as the column name?
Yes, and if we don't skip it, it will be a breaking change for existing users.
There was a problem hiding this comment.
Added doc.go, now instead of comma optional tags will be separate by a semicolan (;) and -> is supported similar to GORM https://gorm.io/docs/models.html#Fields-Tags
🤖 I have created a release *beep* *boop* --- ## [1.86.0](spanner/v1.85.1...spanner/v1.86.0) (2025-09-26) ### Features * **spanner:** Support "readOnly" column tag parsing for Go struct operations ([#12895](#12895)) ([003abca](003abca)) ### Bug Fixes * **spanner:** Use fresh context for rollback ([#12897](#12897)) ([99c7eeb](99c7eeb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Fixes: #8933