You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

133 lines
3.0 KiB

  1. // Copyright 2019 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. // Code generated by gapic-generator. DO NOT EDIT.
  15. package storage_test
  16. import (
  17. "context"
  18. "io"
  19. storage "cloud.google.com/go/bigquery/storage/apiv1beta1"
  20. storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1"
  21. )
  22. func ExampleNewBigQueryStorageClient() {
  23. ctx := context.Background()
  24. c, err := storage.NewBigQueryStorageClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleBigQueryStorageClient_CreateReadSession() {
  32. ctx := context.Background()
  33. c, err := storage.NewBigQueryStorageClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &storagepb.CreateReadSessionRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. resp, err := c.CreateReadSession(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. // TODO: Use resp.
  45. _ = resp
  46. }
  47. func ExampleBigQueryStorageClient_ReadRows() {
  48. ctx := context.Background()
  49. c, err := storage.NewBigQueryStorageClient(ctx)
  50. if err != nil {
  51. // TODO: Handle error.
  52. }
  53. req := &storagepb.ReadRowsRequest{
  54. // TODO: Fill request struct fields.
  55. }
  56. stream, err := c.ReadRows(ctx, req)
  57. if err != nil {
  58. // TODO: Handle error.
  59. }
  60. for {
  61. resp, err := stream.Recv()
  62. if err == io.EOF {
  63. break
  64. }
  65. if err != nil {
  66. // TODO: handle error.
  67. }
  68. // TODO: Use resp.
  69. _ = resp
  70. }
  71. }
  72. func ExampleBigQueryStorageClient_BatchCreateReadSessionStreams() {
  73. ctx := context.Background()
  74. c, err := storage.NewBigQueryStorageClient(ctx)
  75. if err != nil {
  76. // TODO: Handle error.
  77. }
  78. req := &storagepb.BatchCreateReadSessionStreamsRequest{
  79. // TODO: Fill request struct fields.
  80. }
  81. resp, err := c.BatchCreateReadSessionStreams(ctx, req)
  82. if err != nil {
  83. // TODO: Handle error.
  84. }
  85. // TODO: Use resp.
  86. _ = resp
  87. }
  88. func ExampleBigQueryStorageClient_FinalizeStream() {
  89. ctx := context.Background()
  90. c, err := storage.NewBigQueryStorageClient(ctx)
  91. if err != nil {
  92. // TODO: Handle error.
  93. }
  94. req := &storagepb.FinalizeStreamRequest{
  95. // TODO: Fill request struct fields.
  96. }
  97. err = c.FinalizeStream(ctx, req)
  98. if err != nil {
  99. // TODO: Handle error.
  100. }
  101. }
  102. func ExampleBigQueryStorageClient_SplitReadStream() {
  103. ctx := context.Background()
  104. c, err := storage.NewBigQueryStorageClient(ctx)
  105. if err != nil {
  106. // TODO: Handle error.
  107. }
  108. req := &storagepb.SplitReadStreamRequest{
  109. // TODO: Fill request struct fields.
  110. }
  111. resp, err := c.SplitReadStream(ctx, req)
  112. if err != nil {
  113. // TODO: Handle error.
  114. }
  115. // TODO: Use resp.
  116. _ = resp
  117. }