...
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto2";
16
17package testdata;
18
19// Source protos located in github.com/googleapis/googleapis
20import "google/cloud/bigquery/storage/v1/annotations.proto";
21
22option go_package = "cloud.google.com/go/bigquery/storage/managedwriter/testdata";
23
24
25enum Proto2ExampleEnum {
26 P2_UNDEFINED = 0;
27 P2_THING = 1;
28 P2_OTHER_THING = 2;
29 P2_THIRD_THING = 3;
30}
31
32// Validation message in proto2 syntax with all
33// fields being required.
34message ValidationP2Required {
35 required double double_field = 1;
36 required float float_field = 2;
37 required int32 int32_field = 3;
38 required int64 int64_field = 4;
39 required uint32 uint32_field = 5;
40 //required uint64 uint64_field = 6;
41 required sint32 sint32_field = 7;
42 required sint64 sint64_field = 8;
43 required fixed32 fixed32_field = 9;
44 //required fixed64 fixed64_field = 10;
45 required sfixed32 sfixed32_field = 11;
46 required sfixed64 sfixed64_field = 12;
47 required bool bool_field = 13;
48 required string string_field = 14;
49 required bytes bytes_field = 15;
50 required Proto2ExampleEnum enum_field = 16;
51}
52
53// Validation message in proto2 syntax with all
54// fields being optional.
55message ValidationP2Optional {
56 optional double double_field = 1;
57 optional float float_field = 2;
58 optional int32 int32_field = 3;
59 optional int64 int64_field = 4;
60 optional uint32 uint32_field = 5;
61 //optional uint64 uint64_field = 6;
62 optional sint32 sint32_field = 7;
63 optional sint64 sint64_field = 8;
64 optional fixed32 fixed32_field = 9;
65 //optional fixed64 fixed64_field = 10;
66 optional sfixed32 sfixed32_field = 11;
67 optional sfixed64 sfixed64_field = 12;
68 optional bool bool_field = 13;
69 optional string string_field = 14;
70 optional bytes bytes_field = 15;
71 optional Proto2ExampleEnum enum_field = 16;
72}
73
74// Validation message in proto2 syntax with all
75// fields being optional and having custom defaults.
76message ValidationP2OptionalWithDefaults {
77 optional double double_field = 1 [default = 1.11];
78 optional float float_field = 2 [default = 2.22];
79 optional int32 int32_field = 3 [default = 3];
80 optional int64 int64_field = 4 [default = 4];
81 optional uint32 uint32_field = 5 [default = 5];
82 //optional uint64 uint64_field = 6 [default = 6];
83 optional sint32 sint32_field = 7 [default = 7];
84 optional sint64 sint64_field = 8 [default = 8];
85 optional fixed32 fixed32_field = 9 [default = 9];
86 //optional fixed64 fixed64_field = 10 [default = 10];
87 optional sfixed32 sfixed32_field = 11 [default = 11];
88 optional sfixed64 sfixed64_field = 12 [default = 12];
89 optional bool bool_field = 13 [default = true];
90 optional string string_field = 14 [default = "custom default"];
91 optional bytes bytes_field = 15 [default = "optional bytes"];
92 optional Proto2ExampleEnum enum_field = 16 [default = P2_OTHER_THING];
93}
94
95// Validating the behavior of unpacked repeated scalar values.
96message ValidationP2UnpackedRepeated {
97 optional int64 id = 1;
98 repeated double double_repeated = 2;
99 repeated float float_repeated = 3;
100 repeated int32 int32_repeated = 4;
101 repeated int64 int64_repeated = 5;
102 repeated uint32 uint32_repeated = 6;
103 repeated sint32 sint32_repeated = 7;
104 repeated sint64 sint64_repeated = 8;
105 repeated fixed32 fixed32_repeated = 9;
106 repeated sfixed32 sfixed32_repeated = 10;
107 repeated sfixed64 sfixed64_repeated = 11;
108 repeated bool bool_repeated = 12;
109 repeated Proto2ExampleEnum enum_repeated = 13;
110}
111
112// Validating the behavior of packed repeated scalar values.
113message ValidationP2PackedRepeated {
114 optional int64 id = 1;
115 repeated double double_repeated = 2 [packed = true];
116 repeated float float_repeated = 3 [packed = true];
117 repeated int32 int32_repeated = 4 [packed = true];
118 repeated int64 int64_repeated = 5 [packed = true];
119 repeated uint32 uint32_repeated = 6 [packed = true];
120 repeated sint32 sint32_repeated = 7 [packed = true];
121 repeated sint64 sint64_repeated = 8 [packed = true];
122 repeated fixed32 fixed32_repeated = 9 [packed = true];
123 repeated sfixed32 sfixed32_repeated = 10 [packed = true];
124 repeated sfixed64 sfixed64_repeated = 11 [packed = true];
125 repeated bool bool_repeated = 12 [packed = true];
126 repeated Proto2ExampleEnum enum_repeated = 13 [packed = true];
127}
128
129// Validating the behavior of column annotations to remap from a given
130// proto field name to a custom BigQuery column name.
131message ValidationP2ColumnAnnotations {
132 optional string first = 1;
133 optional string second = 2 [(google.cloud.bigquery.storage.v1.column_name) = "特別コラム"];
134 optional string third = 3 [(google.cloud.bigquery.storage.v1.column_name) = "second"];
135}
136
137message ExampleEmployeeCDC {
138 optional int64 id = 1; // Primary Key (not enforced)
139 optional string username = 2;
140 optional string given_name = 3;
141 repeated string departments = 4;
142 optional int64 salary = 5;
143 optional string _CHANGE_TYPE = 999; // We give it a high tag number to avoid conflicts with normal evolution of the record.
144}
View as plain text