diff --git a/v2/module/builtin/templates/operation.go.tpl b/v2/module/builtin/templates/operation.go.tpl index e782f20..fc23ee1 100644 --- a/v2/module/builtin/templates/operation.go.tpl +++ b/v2/module/builtin/templates/operation.go.tpl @@ -47,8 +47,8 @@ func ({{ $short }} *{{ .Name }}) UpdateColumns(ctx context.Context, cols ...stri // Find{{ .Name }} gets a {{ .Name }} by primary key func Find{{ .Name }}(ctx context.Context, db YODB{{ goParams .PrimaryKeyFields true true }}) (*{{ .Name }}, error) { - key := spanner.Key{ {{ goEncodedParams .PrimaryKeyFields false }} } - row, err := db.ReadRow(ctx, "{{ $table }}", key, {{ .Name }}Columns()) + _key := spanner.Key{ {{ goEncodedParams .PrimaryKeyFields false }} } + row, err := db.ReadRow(ctx, "{{ $table }}", _key, {{ .Name }}Columns()) if err != nil { return nil, newError("Find{{ .Name }}", "{{ $table }}", err) } diff --git a/v2/test/testmodels/default/composite_primary_key.yo.go b/v2/test/testmodels/default/composite_primary_key.yo.go index d81f881..c245e1a 100644 --- a/v2/test/testmodels/default/composite_primary_key.yo.go +++ b/v2/test/testmodels/default/composite_primary_key.yo.go @@ -168,8 +168,8 @@ func (cpk *CompositePrimaryKey) UpdateColumns(ctx context.Context, cols ...strin // FindCompositePrimaryKey gets a CompositePrimaryKey by primary key func FindCompositePrimaryKey(ctx context.Context, db YODB, pKey1 string, pKey2 int64) (*CompositePrimaryKey, error) { - key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} - row, err := db.ReadRow(ctx, "CompositePrimaryKeys", key, CompositePrimaryKeyColumns()) + _key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} + row, err := db.ReadRow(ctx, "CompositePrimaryKeys", _key, CompositePrimaryKeyColumns()) if err != nil { return nil, newError("FindCompositePrimaryKey", "CompositePrimaryKeys", err) } diff --git a/v2/test/testmodels/default/custom_composite_primary_key.yo.go b/v2/test/testmodels/default/custom_composite_primary_key.yo.go index 10ab66d..35fc0fb 100644 --- a/v2/test/testmodels/default/custom_composite_primary_key.yo.go +++ b/v2/test/testmodels/default/custom_composite_primary_key.yo.go @@ -168,8 +168,8 @@ func (ccpk *CustomCompositePrimaryKey) UpdateColumns(ctx context.Context, cols . // FindCustomCompositePrimaryKey gets a CustomCompositePrimaryKey by primary key func FindCustomCompositePrimaryKey(ctx context.Context, db YODB, pKey1 string, pKey2 uint32) (*CustomCompositePrimaryKey, error) { - key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} - row, err := db.ReadRow(ctx, "CustomCompositePrimaryKeys", key, CustomCompositePrimaryKeyColumns()) + _key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} + row, err := db.ReadRow(ctx, "CustomCompositePrimaryKeys", _key, CustomCompositePrimaryKeyColumns()) if err != nil { return nil, newError("FindCustomCompositePrimaryKey", "CustomCompositePrimaryKeys", err) } diff --git a/v2/test/testmodels/default/custom_primitive_type.yo.go b/v2/test/testmodels/default/custom_primitive_type.yo.go index d376783..c11975b 100644 --- a/v2/test/testmodels/default/custom_primitive_type.yo.go +++ b/v2/test/testmodels/default/custom_primitive_type.yo.go @@ -348,8 +348,8 @@ func (cpt *CustomPrimitiveType) UpdateColumns(ctx context.Context, cols ...strin // FindCustomPrimitiveType gets a CustomPrimitiveType by primary key func FindCustomPrimitiveType(ctx context.Context, db YODB, pKey string) (*CustomPrimitiveType, error) { - key := spanner.Key{yoEncode(pKey)} - row, err := db.ReadRow(ctx, "CustomPrimitiveTypes", key, CustomPrimitiveTypeColumns()) + _key := spanner.Key{yoEncode(pKey)} + row, err := db.ReadRow(ctx, "CustomPrimitiveTypes", _key, CustomPrimitiveTypeColumns()) if err != nil { return nil, newError("FindCustomPrimitiveType", "CustomPrimitiveTypes", err) } diff --git a/v2/test/testmodels/default/fereign_item.yo.go b/v2/test/testmodels/default/fereign_item.yo.go index 8a7619f..5bf541d 100644 --- a/v2/test/testmodels/default/fereign_item.yo.go +++ b/v2/test/testmodels/default/fereign_item.yo.go @@ -138,8 +138,8 @@ func (fi *FereignItem) UpdateColumns(ctx context.Context, cols ...string) (*span // FindFereignItem gets a FereignItem by primary key func FindFereignItem(ctx context.Context, db YODB, id int64) (*FereignItem, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "FereignItems", key, FereignItemColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "FereignItems", _key, FereignItemColumns()) if err != nil { return nil, newError("FindFereignItem", "FereignItems", err) } diff --git a/v2/test/testmodels/default/full_type.yo.go b/v2/test/testmodels/default/full_type.yo.go index 577c281..2d37792 100644 --- a/v2/test/testmodels/default/full_type.yo.go +++ b/v2/test/testmodels/default/full_type.yo.go @@ -352,8 +352,8 @@ func (ft *FullType) UpdateColumns(ctx context.Context, cols ...string) (*spanner // FindFullType gets a FullType by primary key func FindFullType(ctx context.Context, db YODB, pKey string) (*FullType, error) { - key := spanner.Key{yoEncode(pKey)} - row, err := db.ReadRow(ctx, "FullTypes", key, FullTypeColumns()) + _key := spanner.Key{yoEncode(pKey)} + row, err := db.ReadRow(ctx, "FullTypes", _key, FullTypeColumns()) if err != nil { return nil, newError("FindFullType", "FullTypes", err) } diff --git a/v2/test/testmodels/default/generated_column.yo.go b/v2/test/testmodels/default/generated_column.yo.go index e710913..210c06e 100644 --- a/v2/test/testmodels/default/generated_column.yo.go +++ b/v2/test/testmodels/default/generated_column.yo.go @@ -144,8 +144,8 @@ func (gc *GeneratedColumn) UpdateColumns(ctx context.Context, cols ...string) (* // FindGeneratedColumn gets a GeneratedColumn by primary key func FindGeneratedColumn(ctx context.Context, db YODB, id int64) (*GeneratedColumn, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "GeneratedColumns", key, GeneratedColumnColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "GeneratedColumns", _key, GeneratedColumnColumns()) if err != nil { return nil, newError("FindGeneratedColumn", "GeneratedColumns", err) } diff --git a/v2/test/testmodels/default/inflection.yo.go b/v2/test/testmodels/default/inflection.yo.go index 1368ffa..d01bd73 100644 --- a/v2/test/testmodels/default/inflection.yo.go +++ b/v2/test/testmodels/default/inflection.yo.go @@ -131,8 +131,8 @@ func (i *Inflection) UpdateColumns(ctx context.Context, cols ...string) (*spanne // FindInflection gets a Inflection by primary key func FindInflection(ctx context.Context, db YODB, x string) (*Inflection, error) { - key := spanner.Key{yoEncode(x)} - row, err := db.ReadRow(ctx, "Inflectionzz", key, InflectionColumns()) + _key := spanner.Key{yoEncode(x)} + row, err := db.ReadRow(ctx, "Inflectionzz", _key, InflectionColumns()) if err != nil { return nil, newError("FindInflection", "Inflectionzz", err) } diff --git a/v2/test/testmodels/default/item.yo.go b/v2/test/testmodels/default/item.yo.go index bc2d24e..0eff9f8 100644 --- a/v2/test/testmodels/default/item.yo.go +++ b/v2/test/testmodels/default/item.yo.go @@ -131,8 +131,8 @@ func (i *Item) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Muta // FindItem gets a Item by primary key func FindItem(ctx context.Context, db YODB, id int64) (*Item, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "Items", key, ItemColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "Items", _key, ItemColumns()) if err != nil { return nil, newError("FindItem", "Items", err) } diff --git a/v2/test/testmodels/default/max_length.yo.go b/v2/test/testmodels/default/max_length.yo.go index 4ba9f9b..38ec290 100644 --- a/v2/test/testmodels/default/max_length.yo.go +++ b/v2/test/testmodels/default/max_length.yo.go @@ -131,8 +131,8 @@ func (ml *MaxLength) UpdateColumns(ctx context.Context, cols ...string) (*spanne // FindMaxLength gets a MaxLength by primary key func FindMaxLength(ctx context.Context, db YODB, maxString string) (*MaxLength, error) { - key := spanner.Key{yoEncode(maxString)} - row, err := db.ReadRow(ctx, "MaxLengths", key, MaxLengthColumns()) + _key := spanner.Key{yoEncode(maxString)} + row, err := db.ReadRow(ctx, "MaxLengths", _key, MaxLengthColumns()) if err != nil { return nil, newError("FindMaxLength", "MaxLengths", err) } diff --git a/v2/test/testmodels/default/snake_case.yo.go b/v2/test/testmodels/default/snake_case.yo.go index eeaaa7d..060667e 100644 --- a/v2/test/testmodels/default/snake_case.yo.go +++ b/v2/test/testmodels/default/snake_case.yo.go @@ -139,8 +139,8 @@ func (sc *SnakeCase) UpdateColumns(ctx context.Context, cols ...string) (*spanne // FindSnakeCase gets a SnakeCase by primary key func FindSnakeCase(ctx context.Context, db YODB, id int64) (*SnakeCase, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "snake_cases", key, SnakeCaseColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "snake_cases", _key, SnakeCaseColumns()) if err != nil { return nil, newError("FindSnakeCase", "snake_cases", err) } diff --git a/v2/test/testmodels/legacy_default/composite_primary_key.yo.go b/v2/test/testmodels/legacy_default/composite_primary_key.yo.go index b5b825b..6db3b72 100644 --- a/v2/test/testmodels/legacy_default/composite_primary_key.yo.go +++ b/v2/test/testmodels/legacy_default/composite_primary_key.yo.go @@ -168,8 +168,8 @@ func (cpk *CompositePrimaryKey) UpdateColumns(ctx context.Context, cols ...strin // FindCompositePrimaryKey gets a CompositePrimaryKey by primary key func FindCompositePrimaryKey(ctx context.Context, db YODB, pKey1 string, pKey2 int64) (*CompositePrimaryKey, error) { - key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} - row, err := db.ReadRow(ctx, "CompositePrimaryKeys", key, CompositePrimaryKeyColumns()) + _key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} + row, err := db.ReadRow(ctx, "CompositePrimaryKeys", _key, CompositePrimaryKeyColumns()) if err != nil { return nil, newError("FindCompositePrimaryKey", "CompositePrimaryKeys", err) } diff --git a/v2/test/testmodels/legacy_default/custom_composite_primary_key.yo.go b/v2/test/testmodels/legacy_default/custom_composite_primary_key.yo.go index b900a6c..6a2932a 100644 --- a/v2/test/testmodels/legacy_default/custom_composite_primary_key.yo.go +++ b/v2/test/testmodels/legacy_default/custom_composite_primary_key.yo.go @@ -168,8 +168,8 @@ func (ccpk *CustomCompositePrimaryKey) UpdateColumns(ctx context.Context, cols . // FindCustomCompositePrimaryKey gets a CustomCompositePrimaryKey by primary key func FindCustomCompositePrimaryKey(ctx context.Context, db YODB, pKey1 string, pKey2 uint32) (*CustomCompositePrimaryKey, error) { - key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} - row, err := db.ReadRow(ctx, "CustomCompositePrimaryKeys", key, CustomCompositePrimaryKeyColumns()) + _key := spanner.Key{yoEncode(pKey1), yoEncode(pKey2)} + row, err := db.ReadRow(ctx, "CustomCompositePrimaryKeys", _key, CustomCompositePrimaryKeyColumns()) if err != nil { return nil, newError("FindCustomCompositePrimaryKey", "CustomCompositePrimaryKeys", err) } diff --git a/v2/test/testmodels/legacy_default/custom_primitive_type.yo.go b/v2/test/testmodels/legacy_default/custom_primitive_type.yo.go index d376783..c11975b 100644 --- a/v2/test/testmodels/legacy_default/custom_primitive_type.yo.go +++ b/v2/test/testmodels/legacy_default/custom_primitive_type.yo.go @@ -348,8 +348,8 @@ func (cpt *CustomPrimitiveType) UpdateColumns(ctx context.Context, cols ...strin // FindCustomPrimitiveType gets a CustomPrimitiveType by primary key func FindCustomPrimitiveType(ctx context.Context, db YODB, pKey string) (*CustomPrimitiveType, error) { - key := spanner.Key{yoEncode(pKey)} - row, err := db.ReadRow(ctx, "CustomPrimitiveTypes", key, CustomPrimitiveTypeColumns()) + _key := spanner.Key{yoEncode(pKey)} + row, err := db.ReadRow(ctx, "CustomPrimitiveTypes", _key, CustomPrimitiveTypeColumns()) if err != nil { return nil, newError("FindCustomPrimitiveType", "CustomPrimitiveTypes", err) } diff --git a/v2/test/testmodels/legacy_default/fereign_item.yo.go b/v2/test/testmodels/legacy_default/fereign_item.yo.go index 8a7619f..5bf541d 100644 --- a/v2/test/testmodels/legacy_default/fereign_item.yo.go +++ b/v2/test/testmodels/legacy_default/fereign_item.yo.go @@ -138,8 +138,8 @@ func (fi *FereignItem) UpdateColumns(ctx context.Context, cols ...string) (*span // FindFereignItem gets a FereignItem by primary key func FindFereignItem(ctx context.Context, db YODB, id int64) (*FereignItem, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "FereignItems", key, FereignItemColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "FereignItems", _key, FereignItemColumns()) if err != nil { return nil, newError("FindFereignItem", "FereignItems", err) } diff --git a/v2/test/testmodels/legacy_default/full_type.yo.go b/v2/test/testmodels/legacy_default/full_type.yo.go index b6663ab..3e9a9ed 100644 --- a/v2/test/testmodels/legacy_default/full_type.yo.go +++ b/v2/test/testmodels/legacy_default/full_type.yo.go @@ -352,8 +352,8 @@ func (ft *FullType) UpdateColumns(ctx context.Context, cols ...string) (*spanner // FindFullType gets a FullType by primary key func FindFullType(ctx context.Context, db YODB, pKey string) (*FullType, error) { - key := spanner.Key{yoEncode(pKey)} - row, err := db.ReadRow(ctx, "FullTypes", key, FullTypeColumns()) + _key := spanner.Key{yoEncode(pKey)} + row, err := db.ReadRow(ctx, "FullTypes", _key, FullTypeColumns()) if err != nil { return nil, newError("FindFullType", "FullTypes", err) } diff --git a/v2/test/testmodels/legacy_default/generated_column.yo.go b/v2/test/testmodels/legacy_default/generated_column.yo.go index e710913..210c06e 100644 --- a/v2/test/testmodels/legacy_default/generated_column.yo.go +++ b/v2/test/testmodels/legacy_default/generated_column.yo.go @@ -144,8 +144,8 @@ func (gc *GeneratedColumn) UpdateColumns(ctx context.Context, cols ...string) (* // FindGeneratedColumn gets a GeneratedColumn by primary key func FindGeneratedColumn(ctx context.Context, db YODB, id int64) (*GeneratedColumn, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "GeneratedColumns", key, GeneratedColumnColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "GeneratedColumns", _key, GeneratedColumnColumns()) if err != nil { return nil, newError("FindGeneratedColumn", "GeneratedColumns", err) } diff --git a/v2/test/testmodels/legacy_default/inflection.yo.go b/v2/test/testmodels/legacy_default/inflection.yo.go index 1368ffa..d01bd73 100644 --- a/v2/test/testmodels/legacy_default/inflection.yo.go +++ b/v2/test/testmodels/legacy_default/inflection.yo.go @@ -131,8 +131,8 @@ func (i *Inflection) UpdateColumns(ctx context.Context, cols ...string) (*spanne // FindInflection gets a Inflection by primary key func FindInflection(ctx context.Context, db YODB, x string) (*Inflection, error) { - key := spanner.Key{yoEncode(x)} - row, err := db.ReadRow(ctx, "Inflectionzz", key, InflectionColumns()) + _key := spanner.Key{yoEncode(x)} + row, err := db.ReadRow(ctx, "Inflectionzz", _key, InflectionColumns()) if err != nil { return nil, newError("FindInflection", "Inflectionzz", err) } diff --git a/v2/test/testmodels/legacy_default/item.yo.go b/v2/test/testmodels/legacy_default/item.yo.go index bc2d24e..0eff9f8 100644 --- a/v2/test/testmodels/legacy_default/item.yo.go +++ b/v2/test/testmodels/legacy_default/item.yo.go @@ -131,8 +131,8 @@ func (i *Item) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Muta // FindItem gets a Item by primary key func FindItem(ctx context.Context, db YODB, id int64) (*Item, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "Items", key, ItemColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "Items", _key, ItemColumns()) if err != nil { return nil, newError("FindItem", "Items", err) } diff --git a/v2/test/testmodels/legacy_default/max_length.yo.go b/v2/test/testmodels/legacy_default/max_length.yo.go index 4ba9f9b..38ec290 100644 --- a/v2/test/testmodels/legacy_default/max_length.yo.go +++ b/v2/test/testmodels/legacy_default/max_length.yo.go @@ -131,8 +131,8 @@ func (ml *MaxLength) UpdateColumns(ctx context.Context, cols ...string) (*spanne // FindMaxLength gets a MaxLength by primary key func FindMaxLength(ctx context.Context, db YODB, maxString string) (*MaxLength, error) { - key := spanner.Key{yoEncode(maxString)} - row, err := db.ReadRow(ctx, "MaxLengths", key, MaxLengthColumns()) + _key := spanner.Key{yoEncode(maxString)} + row, err := db.ReadRow(ctx, "MaxLengths", _key, MaxLengthColumns()) if err != nil { return nil, newError("FindMaxLength", "MaxLengths", err) } diff --git a/v2/test/testmodels/legacy_default/snake_case.yo.go b/v2/test/testmodels/legacy_default/snake_case.yo.go index 55e714c..1756049 100644 --- a/v2/test/testmodels/legacy_default/snake_case.yo.go +++ b/v2/test/testmodels/legacy_default/snake_case.yo.go @@ -139,8 +139,8 @@ func (sc *SnakeCase) UpdateColumns(ctx context.Context, cols ...string) (*spanne // FindSnakeCase gets a SnakeCase by primary key func FindSnakeCase(ctx context.Context, db YODB, id int64) (*SnakeCase, error) { - key := spanner.Key{yoEncode(id)} - row, err := db.ReadRow(ctx, "snake_cases", key, SnakeCaseColumns()) + _key := spanner.Key{yoEncode(id)} + row, err := db.ReadRow(ctx, "snake_cases", _key, SnakeCaseColumns()) if err != nil { return nil, newError("FindSnakeCase", "snake_cases", err) }