Skip to content

Commit

Permalink
Merge branch 'main' into alias-beta-part1
Browse files Browse the repository at this point in the history
  • Loading branch information
codyoss authored Sep 16, 2022
2 parents 4ec39bb + ef2b0b1 commit 726d5a2
Show file tree
Hide file tree
Showing 21 changed files with 987 additions and 84 deletions.
8 changes: 4 additions & 4 deletions apikeys/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
cloud.google.com/go v0.103.0
github.com/golang/protobuf v1.5.2
github.com/googleapis/gax-go/v2 v2.5.1
google.golang.org/api v0.95.0
google.golang.org/genproto v0.0.0-20220819153447-c7cd466b0e09
google.golang.org/api v0.96.0
google.golang.org/genproto v0.0.0-20220916134934-764224ccc2d1
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.1
)
Expand All @@ -18,9 +18,9 @@ require (
github.com/google/go-cmp v0.5.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
golang.org/x/sys v0.0.0-20220624220833-87e55d714810 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.7 // indirect
)
14 changes: 8 additions & 6 deletions apikeys/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ=
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI=
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -392,8 +393,9 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220624220833-87e55d714810 h1:rHZQSjJdAI4Xf5Qzeh2bBc5YJIkPFVM6oDtMFYmgws0=
golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -508,8 +510,8 @@ google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3
google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o=
google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g=
google.golang.org/api v0.86.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
google.golang.org/api v0.95.0 h1:d1c24AAS01DYqXreBeuVV7ewY/U8Mnhh47pwtsgVtYg=
google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI=
google.golang.org/api v0.96.0 h1:F60cuQPJq7K7FzsxMYHAUJSiXh2oKctHxBMbDygxhfM=
google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
Expand Down Expand Up @@ -599,8 +601,8 @@ google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljW
google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
google.golang.org/genproto v0.0.0-20220819153447-c7cd466b0e09 h1:iw8luj804hqA2C43tq4SXb4OQNgaJU0KzSZHOHfdA4U=
google.golang.org/genproto v0.0.0-20220819153447-c7cd466b0e09/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
google.golang.org/genproto v0.0.0-20220916134934-764224ccc2d1 h1:f+XAjNNl0e5qs8BbB5iQMTYGQjpDbsG4nyAyAuKg3M4=
google.golang.org/genproto v0.0.0-20220916134934-764224ccc2d1/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand Down
168 changes: 155 additions & 13 deletions bigquery/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,7 @@ func TestIntegration_QueryParameters(t *testing.T) {
dtm := civil.DateTime{Date: d, Time: tm}
ts := time.Date(2016, 3, 20, 15, 04, 05, 0, time.UTC)
rat := big.NewRat(13, 10)
bigRat := big.NewRat(12345, 10e10)

type ss struct {
String string
Expand All @@ -1828,73 +1829,73 @@ func TestIntegration_QueryParameters(t *testing.T) {
}{
{
"SELECT @val",
[]QueryParameter{{"val", 1}},
[]QueryParameter{{Name: "val", Value: 1}},
[]Value{int64(1)},
int64(1),
},
{
"SELECT @val",
[]QueryParameter{{"val", 1.3}},
[]QueryParameter{{Name: "val", Value: 1.3}},
[]Value{1.3},
1.3,
},
{
"SELECT @val",
[]QueryParameter{{"val", rat}},
[]QueryParameter{{Name: "val", Value: rat}},
[]Value{rat},
rat,
},
{
"SELECT @val",
[]QueryParameter{{"val", true}},
[]QueryParameter{{Name: "val", Value: true}},
[]Value{true},
true,
},
{
"SELECT @val",
[]QueryParameter{{"val", "ABC"}},
[]QueryParameter{{Name: "val", Value: "ABC"}},
[]Value{"ABC"},
"ABC",
},
{
"SELECT @val",
[]QueryParameter{{"val", []byte("foo")}},
[]QueryParameter{{Name: "val", Value: []byte("foo")}},
[]Value{[]byte("foo")},
[]byte("foo"),
},
{
"SELECT @val",
[]QueryParameter{{"val", ts}},
[]QueryParameter{{Name: "val", Value: ts}},
[]Value{ts},
ts,
},
{
"SELECT @val",
[]QueryParameter{{"val", []time.Time{ts, ts}}},
[]QueryParameter{{Name: "val", Value: []time.Time{ts, ts}}},
[]Value{[]Value{ts, ts}},
[]interface{}{ts, ts},
},
{
"SELECT @val",
[]QueryParameter{{"val", dtm}},
[]QueryParameter{{Name: "val", Value: dtm}},
[]Value{civil.DateTime{Date: d, Time: rtm}},
civil.DateTime{Date: d, Time: rtm},
},
{
"SELECT @val",
[]QueryParameter{{"val", d}},
[]QueryParameter{{Name: "val", Value: d}},
[]Value{d},
d,
},
{
"SELECT @val",
[]QueryParameter{{"val", tm}},
[]QueryParameter{{Name: "val", Value: tm}},
[]Value{rtm},
rtm,
},
{
"SELECT @val",
[]QueryParameter{{"val", s{ts, []string{"a", "b"}, ss{"c"}, []ss{{"d"}, {"e"}}}}},
[]QueryParameter{{Name: "val", Value: s{ts, []string{"a", "b"}, ss{"c"}, []ss{{"d"}, {"e"}}}}},
[]Value{[]Value{ts, []Value{"a", "b"}, []Value{"c"}, []Value{[]Value{"d"}, []Value{"e"}}}},
map[string]interface{}{
"Timestamp": ts,
Expand All @@ -1908,7 +1909,7 @@ func TestIntegration_QueryParameters(t *testing.T) {
},
{
"SELECT @val.Timestamp, @val.SubStruct.String",
[]QueryParameter{{"val", s{Timestamp: ts, SubStruct: ss{"a"}}}},
[]QueryParameter{{Name: "val", Value: s{Timestamp: ts, SubStruct: ss{"a"}}}},
[]Value{ts, "a"},
map[string]interface{}{
"Timestamp": ts,
Expand All @@ -1917,6 +1918,147 @@ func TestIntegration_QueryParameters(t *testing.T) {
"SubStructArray": nil,
},
},
{
"SELECT @val",
[]QueryParameter{
{
Name: "val",
Value: &QueryParameterValue{
Type: StandardSQLDataType{
TypeKind: "BIGNUMERIC",
},
Value: BigNumericString(bigRat),
},
},
},
[]Value{bigRat},
bigRat,
},
{
"SELECT @val",
[]QueryParameter{
{
Name: "val",
Value: &QueryParameterValue{
ArrayValue: []QueryParameterValue{
{Value: "a"},
{Value: "b"},
},
Type: StandardSQLDataType{
ArrayElementType: &StandardSQLDataType{
TypeKind: "STRING",
},
},
},
},
},
[]Value{[]Value{"a", "b"}},
[]interface{}{"a", "b"},
},
{
"SELECT @val",
[]QueryParameter{
{
Name: "val",
Value: &QueryParameterValue{
StructValue: map[string]QueryParameterValue{
"Timestamp": {
Value: ts,
},
"BigNumericArray": {
ArrayValue: []QueryParameterValue{
{Value: BigNumericString(bigRat)},
{Value: BigNumericString(rat)},
},
},
"ArraySingleValueStruct": {
ArrayValue: []QueryParameterValue{
{StructValue: map[string]QueryParameterValue{
"Number": {
Value: int64(42),
},
}},
{StructValue: map[string]QueryParameterValue{
"Number": {
Value: int64(43),
},
}},
},
},
"SubStruct": {
StructValue: map[string]QueryParameterValue{
"String": {
Value: "c",
},
},
},
},
Type: StandardSQLDataType{
StructType: &StandardSQLStructType{
Fields: []*StandardSQLField{
{
Name: "Timestamp",
Type: &StandardSQLDataType{
TypeKind: "TIMESTAMP",
},
},
{
Name: "BigNumericArray",
Type: &StandardSQLDataType{
ArrayElementType: &StandardSQLDataType{
TypeKind: "BIGNUMERIC",
},
},
},
{
Name: "ArraySingleValueStruct",
Type: &StandardSQLDataType{
ArrayElementType: &StandardSQLDataType{
StructType: &StandardSQLStructType{
Fields: []*StandardSQLField{
{
Name: "Number",
Type: &StandardSQLDataType{
TypeKind: "INT64",
},
},
},
},
},
},
},
{
Name: "SubStruct",
Type: &StandardSQLDataType{
StructType: &StandardSQLStructType{
Fields: []*StandardSQLField{
{
Name: "String",
Type: &StandardSQLDataType{
TypeKind: "STRING",
},
},
},
},
},
},
},
},
},
},
},
},
[]Value{[]Value{ts, []Value{bigRat, rat}, []Value{[]Value{int64(42)}, []Value{int64(43)}}, []Value{"c"}}},
map[string]interface{}{
"Timestamp": ts,
"BigNumericArray": []interface{}{bigRat, rat},
"ArraySingleValueStruct": []interface{}{
map[string]interface{}{"Number": int64(42)},
map[string]interface{}{"Number": int64(43)},
},
"SubStruct": map[string]interface{}{"String": "c"},
},
},
}
for _, c := range testCases {
q := client.Query(c.query)
Expand Down
Loading

0 comments on commit 726d5a2

Please sign in to comment.