MCPcopy Index your code
hub / github.com/google/go-cloud / ExampleSubscription_As

Function ExampleSubscription_As

pubsub/example_test.go:141–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139}
140
141func ExampleSubscription_As() {
142 // This example is specific to the gcppubsub implementation; it demonstrates
143 // access to the underlying SubscriberClient type.
144 // The types exposed for As by gcppubsub are documented in
145 // https://godoc.org/gocloud.dev/pubsub/gcppubsub#hdr-As
146
147 ctx := context.Background()
148 sub, err := pubsub.OpenSubscription(ctx, "gcppubsub://project/topic")
149 if err != nil {
150 log.Fatal(err)
151 }
152 defer sub.Shutdown(ctx)
153
154 var sc *pbraw.SubscriberClient
155 if sub.As(&sc) {
156 _ = sc.CallOptions
157 }
158}
159
160func ExampleSubscription_ErrorAs() {
161 // This example is specific to the gcppubsub implementation; it demonstrates

Callers

nothing calls this directly

Calls 3

OpenSubscriptionFunction · 0.92
ShutdownMethod · 0.65
AsMethod · 0.65

Tested by

no test coverage detected