()
| 448 | } |
| 449 | |
| 450 | func ExampleListObject_As() { |
| 451 | // This example is specific to the gcsblob implementation; it demonstrates |
| 452 | // access to the underlying cloud.google.com/go/storage.ObjectAttrs type. |
| 453 | // The types exposed for As by gcsblob are documented in |
| 454 | // https://godoc.org/gocloud.dev/blob/gcsblob#hdr-As |
| 455 | |
| 456 | ctx := context.Background() |
| 457 | |
| 458 | b, err := blob.OpenBucket(ctx, "gs://my-bucket") |
| 459 | if err != nil { |
| 460 | log.Fatal(err) |
| 461 | } |
| 462 | defer b.Close() |
| 463 | |
| 464 | iter := b.List(nil) |
| 465 | for { |
| 466 | obj, err := iter.Next(ctx) |
| 467 | if err == io.EOF { |
| 468 | break |
| 469 | } |
| 470 | if err != nil { |
| 471 | log.Fatal(err) |
| 472 | } |
| 473 | // Access storage.ObjectAttrs via oa here. |
| 474 | var oa storage.ObjectAttrs |
| 475 | if obj.As(&oa) { |
| 476 | _ = oa.Owner |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | func ExampleListOptions() { |
| 482 | // This example is specific to the gcsblob implementation; it demonstrates |
nothing calls this directly
no test coverage detected