Documentation
¶
Overview ¶
Package storagex extends cloud.google.com/go/storage.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
*storage.BucketHandle
}
Bucket extends storage.BucketHandle operations.
func (*Bucket) Walk ¶
Walk visits each GCS object under pathPrefix and calls visit with every object. The given pathPrefix may be a GCS object name, in which case Walk will visit only that object.
Example ¶
ctx := context.Background()
client, err := storage.NewClient(ctx)
rtx.Must(err, "Failed to allocate storage.Client")
bucket := NewBucket(client.Bucket("your-bucket-name"))
bucket.Walk(ctx, "path/in/bucket", func(o *Object) error {
fmt.Println(o.ObjectName(), o.LocalName())
return nil
})
type Object ¶
type Object struct {
*storage.ObjectHandle
// contains filtered or unexported fields
}
Object extends the storage.ObjectHandle operations on GCS Objects. Objects are generated during a Bucket.Walk.
func (*Object) LocalName ¶
LocalName returns a path suitable for creating a local file. The local name may include path components because it is derived from the original GCS Object name with the original Walk pathPrefix removed. If the pathPrefix equals the GCS Object name (such as when pathPrefix is a single object), then the Object base name is returned.