| 182 | } |
| 183 | |
| 184 | func ExampleTopic_As() { |
| 185 | // This example is specific to the gcppubsub implementation; it demonstrates |
| 186 | // access to the underlying PublisherClient type. |
| 187 | // The types exposed for As by gcppubsub are documented in |
| 188 | // https://godoc.org/gocloud.dev/pubsub/gcppubsub#hdr-As |
| 189 | |
| 190 | ctx := context.Background() |
| 191 | topic, err := pubsub.OpenTopic(ctx, "gcppubsub://project/topic") |
| 192 | if err != nil { |
| 193 | log.Fatal(err) |
| 194 | } |
| 195 | defer topic.Shutdown(ctx) |
| 196 | |
| 197 | var pc *pbraw.PublisherClient |
| 198 | if topic.As(&pc) { |
| 199 | _ = pc |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | func ExampleTopic_ErrorAs() { |
| 204 | // This example is specific to the gcppubsub implementation; it demonstrates |