cloudstore

package
v0.0.0-...-0dea3d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

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

func Client

func Client(ctx context.Context, options ...option.ClientOption) (*gcs.Client, error)

func CloudStorageEvent

func CloudStorageEvent(c *gin.Context)

func CreateBucket

func CreateBucket(ctx context.Context, bucket string) (*gcs.BucketHandle, error)

func DeleteBucket

func DeleteBucket(ctx context.Context, bucket string) error

func DeleteObject

func DeleteObject(ctx context.Context, bh *gcs.BucketHandle, path string) error

func ListAllBuckets

func ListAllBuckets(ctx context.Context) []string

func Must

func Must[T any](r T, err error) T

Types

type Bucket

type Bucket struct {
	Name    string     `json:"name"`
	Objects []Metadata `json:"objects"`
}

func BucketWithObjects

func BucketWithObjects(bucket string) (*Bucket, error)

type Location

type Location struct {
	Bucket string
	Name   string
}

func (Location) String

func (l Location) String() string

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

func (Metadata) Dir

func (o Metadata) Dir() string

func (Metadata) Name

func (o Metadata) Name() string

type ReadResult

type ReadResult struct {
	BytesRead int64
	Error     error
}

func ReadObject

func ReadObject(ctx context.Context, bucket string, path string, dst io.Writer) ReadResult

type WriteResult

type WriteResult struct {
	BytesWritten int64
	Error        error
}

func WriteObject

func WriteObject(ctx context.Context, bucket string, path string, src io.Reader) WriteResult

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL