Skip to content

Commit 215e0c8

Browse files
authored
feat(spanner): fix schema naming (#10194)
1 parent 0a86d50 commit 215e0c8

File tree

6 files changed

+97
-90
lines changed

6 files changed

+97
-90
lines changed

spanner/integration_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,19 +2271,19 @@ func TestIntegration_BasicTypes_ProtoColumns(t *testing.T) {
22712271
defer cancel()
22722272
stmts := []string{
22732273
`CREATE PROTO BUNDLE (
2274-
spanner.examples.music.SingerInfo,
2275-
spanner.examples.music.Genre,
2274+
examples.spanner.music.SingerInfo,
2275+
examples.spanner.music.Genre,
22762276
)`,
22772277
`CREATE TABLE Types (
22782278
RowID INT64 NOT NULL,
22792279
Int64a INT64,
22802280
Bytes BYTES(MAX),
22812281
Int64Array ARRAY<INT64>,
22822282
BytesArray ARRAY<BYTES(MAX)>,
2283-
ProtoMessage spanner.examples.music.SingerInfo,
2284-
ProtoEnum spanner.examples.music.Genre,
2285-
ProtoMessageArray ARRAY<spanner.examples.music.SingerInfo>,
2286-
ProtoEnumArray ARRAY<spanner.examples.music.Genre>,
2283+
ProtoMessage examples.spanner.music.SingerInfo,
2284+
ProtoEnum examples.spanner.music.Genre,
2285+
ProtoMessageArray ARRAY<examples.spanner.music.SingerInfo>,
2286+
ProtoEnumArray ARRAY<examples.spanner.music.Genre>,
22872287
) PRIMARY KEY (RowID)`,
22882288
}
22892289

@@ -2512,19 +2512,19 @@ func TestIntegration_BasicTypes_ProtoColumns_Errors(t *testing.T) {
25122512
defer cancel()
25132513
stmts := []string{
25142514
`CREATE PROTO BUNDLE (
2515-
spanner.examples.music.SingerInfo,
2516-
spanner.examples.music.Genre,
2515+
examples.spanner.music.SingerInfo,
2516+
examples.spanner.music.Genre,
25172517
)`,
25182518
`CREATE TABLE Types (
25192519
RowID INT64 NOT NULL,
25202520
Int64a INT64,
25212521
Bytes BYTES(MAX),
25222522
Int64Array ARRAY<INT64>,
25232523
BytesArray ARRAY<BYTES(MAX)>,
2524-
ProtoMessage spanner.examples.music.SingerInfo,
2525-
ProtoEnum spanner.examples.music.Genre,
2526-
ProtoMessageArray ARRAY<spanner.examples.music.SingerInfo>,
2527-
ProtoEnumArray ARRAY<spanner.examples.music.Genre>,
2524+
ProtoMessage examples.spanner.music.SingerInfo,
2525+
ProtoEnum examples.spanner.music.Genre,
2526+
ProtoMessageArray ARRAY<examples.spanner.music.SingerInfo>,
2527+
ProtoEnumArray ARRAY<examples.spanner.music.Genre>,
25282528
) PRIMARY KEY (RowID)`,
25292529
}
25302530
protoDescriptor := readProtoDescriptorFile()
@@ -2607,15 +2607,15 @@ func TestIntegration_ProtoColumns_DML_ParameterizedQueries_Pk_Indexes(t *testing
26072607
defer cancel()
26082608
stmts := []string{
26092609
`CREATE PROTO BUNDLE (
2610-
spanner.examples.music.SingerInfo,
2611-
spanner.examples.music.Genre,
2610+
examples.spanner.music.SingerInfo,
2611+
examples.spanner.music.Genre,
26122612
)`,
26132613
`CREATE TABLE Singers (
26142614
SingerId INT64 NOT NULL,
26152615
FirstName STRING(1024),
26162616
LastName STRING(1024),
2617-
SingerInfo spanner.examples.music.SingerInfo,
2618-
SingerGenre spanner.examples.music.Genre,
2617+
SingerInfo examples.spanner.music.SingerInfo,
2618+
SingerGenre examples.spanner.music.Genre,
26192619
SingerNationality STRING(1024) AS (SingerInfo.nationality) STORED,
26202620
) PRIMARY KEY (SingerNationality, SingerGenre)`,
26212621
`CREATE INDEX SingerByNationalityAndGenre ON Singers(SingerNationality, SingerGenre) STORING (SingerId, FirstName, LastName)`,

spanner/testdata/protos/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#### To generate singer.pb.go and descriptors.pb file from singer.proto using `protoc`
2+
```shell
3+
cd spanner/testdata
4+
protoc --proto_path=protos/ --include_imports --descriptor_set_out=protos/descriptors.pb --go_out=protos/ protos/singer.proto
5+
```
0 Bytes
Binary file not shown.

spanner/testdata/protos/singer.pb.go

Lines changed: 70 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spanner/testdata/protos/singer.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ limitations under the License.
1616

1717
syntax = "proto2";
1818

19-
package spanner.examples.music;
20-
option go_package = "./protos";
19+
package examples.spanner.music;
20+
option go_package = "./";
2121

2222
message SingerInfo {
2323
optional int64 singer_id = 1;

spanner/value_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ func TestEncodeValue(t *testing.T) {
295295
Nationality: proto.String("Country2"),
296296
Genre: &singer2ProtoEnum,
297297
}
298-
protoMessagefqn := "spanner.examples.music.SingerInfo"
299-
protoEnumfqn := "spanner.examples.music.Genre"
298+
protoMessagefqn := "examples.spanner.music.SingerInfo"
299+
protoEnumfqn := "examples.spanner.music.Genre"
300300

301301
var (
302302
tString = stringType()
@@ -1536,8 +1536,8 @@ func TestDecodeValue(t *testing.T) {
15361536
Nationality: proto.String("Country2"),
15371537
Genre: &singer2ProtoEnum,
15381538
}
1539-
protoMessagefqn := "spanner.examples.music.SingerInfo"
1540-
protoEnumfqn := "spanner.examples.music.Genre"
1539+
protoMessagefqn := "examples.spanner.music.SingerInfo"
1540+
protoEnumfqn := "examples.spanner.music.Genre"
15411541

15421542
for _, test := range []struct {
15431543
desc string

0 commit comments

Comments
 (0)