Skip to content

Commit

Permalink
docs(spanner): correct struct field tag syntax (#4709)
Browse files Browse the repository at this point in the history
* `spanner:-` is not valid syntax for a struct field tag. The correct syntax is `spanner:"-"`.
* `spanner:name` has the same problem; it should be `spanner:"name"`.

Co-authored-by: Hengfeng Li <hengfeng@google.com>
  • Loading branch information
astrieanna and hengfengli committed Oct 25, 2021
1 parent db40586 commit 39a8036
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spanner/mutation.go
Expand Up @@ -216,8 +216,8 @@ func InsertMap(table string, in map[string]interface{}) *Mutation {
// codes.AlreadyExists.
//
// The in argument must be a struct or a pointer to a struct. Its exported
// fields specify the column names and values. Use a field tag like "spanner:name"
// to provide an alternative column name, or use "spanner:-" to ignore the field.
// fields specify the column names and values. Use a field tag like `spanner:"name"`
// to provide an alternative column name, or use `spanner:"-"` to ignore the field.
func InsertStruct(table string, in interface{}) (*Mutation, error) {
cols, vals, err := structToMutationParams(in)
if err != nil {
Expand Down Expand Up @@ -285,7 +285,7 @@ func InsertOrUpdateMap(table string, in map[string]interface{}) *Mutation {
//
// The in argument must be a struct or a pointer to a struct. Its exported
// fields specify the column names and values. Use a field tag like
// "spanner:name" to provide an alternative column name, or use "spanner:-" to
// `spanner:"name"` to provide an alternative column name, or use `spanner:"-"` to
// ignore the field.
//
// For a similar example, See UpdateStruct.
Expand Down Expand Up @@ -326,8 +326,8 @@ func ReplaceMap(table string, in map[string]interface{}) *Mutation {
// written become NULL. The row is specified by a Go struct.
//
// The in argument must be a struct or a pointer to a struct. Its exported
// fields specify the column names and values. Use a field tag like "spanner:name"
// to provide an alternative column name, or use "spanner:-" to ignore the field.
// fields specify the column names and values. Use a field tag like `spanner:"name"`
// to provide an alternative column name, or use `spanner:"-"` to ignore the field.
//
// For a similar example, See UpdateStruct.
func ReplaceStruct(table string, in interface{}) (*Mutation, error) {
Expand Down

0 comments on commit 39a8036

Please sign in to comment.