-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gengapic): generate helpers for Go 1.23 iterators (#1542)
This changes starts generating build tag protected adapters for using our iterator types in Go range expressions. Related: googleapis/gax-go#358
- Loading branch information
Showing
13 changed files
with
505 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
func ExampleFooClient_GetManyThings_all() { | ||
ctx := context.Background() | ||
// This snippet has been automatically generated and should be regarded as a code template only. | ||
// It will require modifications to work: | ||
// - It may require correct/in-range values for request initialization. | ||
// - It may require specifying regional endpoints when creating the service client as shown in: | ||
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options | ||
c, err := Bar.NewFooRESTClient(ctx) | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
defer c.Close() | ||
|
||
req := &mypackagepb.PageInputType{ | ||
// TODO: Fill request struct fields. | ||
// See https://pkg.go.dev/mypackage#PageInputType. | ||
} | ||
for resp, err := range c.GetManyThings(ctx, req).All() { | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
// TODO: Use resp. | ||
_ = resp | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
func ExampleClient_GetManyThings_all() { | ||
ctx := context.Background() | ||
// This snippet has been automatically generated and should be regarded as a code template only. | ||
// It will require modifications to work: | ||
// - It may require correct/in-range values for request initialization. | ||
// - It may require specifying regional endpoints when creating the service client as shown in: | ||
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options | ||
c, err := Foo.NewClient(ctx) | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
defer c.Close() | ||
|
||
req := &mypackagepb.PageInputType{ | ||
// TODO: Fill request struct fields. | ||
// See https://pkg.go.dev/mypackage#PageInputType. | ||
} | ||
for resp, err := range c.GetManyThings(ctx, req).All() { | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
// TODO: Use resp. | ||
_ = resp | ||
} | ||
} | ||
|
||
func ExampleClient_ListLocations_all() { | ||
ctx := context.Background() | ||
// This snippet has been automatically generated and should be regarded as a code template only. | ||
// It will require modifications to work: | ||
// - It may require correct/in-range values for request initialization. | ||
// - It may require specifying regional endpoints when creating the service client as shown in: | ||
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options | ||
c, err := Foo.NewClient(ctx) | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
defer c.Close() | ||
|
||
req := &locationpb.ListLocationsRequest{ | ||
// TODO: Fill request struct fields. | ||
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. | ||
} | ||
for resp, err := range c.ListLocations(ctx, req).All() { | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
// TODO: Use resp. | ||
_ = resp | ||
} | ||
} | ||
|
||
func ExampleClient_ListOperations_all() { | ||
ctx := context.Background() | ||
// This snippet has been automatically generated and should be regarded as a code template only. | ||
// It will require modifications to work: | ||
// - It may require correct/in-range values for request initialization. | ||
// - It may require specifying regional endpoints when creating the service client as shown in: | ||
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options | ||
c, err := Foo.NewClient(ctx) | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
defer c.Close() | ||
|
||
req := &longrunningpb.ListOperationsRequest{ | ||
// TODO: Fill request struct fields. | ||
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. | ||
} | ||
for resp, err := range c.ListOperations(ctx, req).All() { | ||
if err != nil { | ||
// TODO: Handle error. | ||
} | ||
// TODO: Use resp. | ||
_ = resp | ||
} | ||
} | ||
|
Oops, something went wrong.