Documentation
¶
Index ¶
- Variables
- func BucketExists(ctx context.Context, bh *gcs.BucketHandle) bool
- func Client(ctx context.Context, options ...option.ClientOption) (*gcs.Client, error)
- func CloudStorageEvent(c *gin.Context)
- func CreateBucket(ctx context.Context, bucket string) (*gcs.BucketHandle, error)
- func DeleteBucket(ctx context.Context, bucket string) error
- func DeleteObject(ctx context.Context, bh *gcs.BucketHandle, path string) error
- func ListAllBuckets(ctx context.Context) []string
- type Bucket
- type Location
- type Metadata
- type ReadResult
- type WriteResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ObjectCreateError = errs.NotCreatedError.NewSubtype("Object Write Error")
View Source
var ObjectWriteError = errs.NotWrittenError.NewSubtype("Object Write Error")
Functions ¶
func BucketExists ¶
func BucketExists(ctx context.Context, bh *gcs.BucketHandle) bool
BucketExists returns true if the bucket exists, false otherwise.
func CloudStorageEvent ¶
func CreateBucket ¶
CreateBucket creates a new bucket with the given name.
func DeleteBucket ¶
DeleteBucket deletes the bucket with the given name.
func DeleteObject ¶
DeleteObject deletes the object at the given path in the given bucket.
func ListAllBuckets ¶
ListAllBuckets returns a list of all buckets in the project.
Types ¶
type Bucket ¶
func BucketWithObjects ¶
BucketWithObjects returns a Bucket object with all objects in the bucket.
type Metadata ¶
type Metadata struct {
Path string `json:"path"`
Size int64 `json:"size"`
ContentType string `json:"content_type"`
CreatedAt *timestamp.Timestamp `json:"created_at"`
LastUpdatedAt *timestamp.Timestamp `json:"last_updated_at"`
}
func AttrToObject ¶
func AttrToObject(attrs *gcs.ObjectAttrs) Metadata
AttrToObject converts a GCS object attributes to a Metadata object.
type ReadResult ¶
func ReadObject ¶
type WriteResult ¶
func WriteObject ¶
WriteObject writes the given io.Reader to the object at the given path in the given bucket.
Click to show internal directories.
Click to hide internal directories.