gcs

package
v0.0.0-...-3138b4c Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)

Variables

View Source
var DefaultExpireDuration = 120 * time.Minute

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Config) (Client, error)

func (Client) CacheKey

func (c Client) CacheKey(object blobstorage.UploadableObject) string

func (Client) Copy

func (c Client) Copy(ctx context.Context, src, dst blobstorage.UploadableObject) error

func (Client) DeleteFile

func (c Client) DeleteFile(ctx context.Context, object blobstorage.UploadableObject) error

func (Client) FileExists

func (c Client) FileExists(ctx context.Context, object blobstorage.UploadableObject) (bool, error)

func (Client) FindFilesWithName

func (c Client) FindFilesWithName(ctx context.Context, bucketName, prefix, filename string) ([]string, error)

func (Client) GetChecksum

func (c Client) GetChecksum(ctx context.Context, object blobstorage.UploadableObject) (string, error)

func (Client) GetPublicURL

func (c Client) GetPublicURL(object blobstorage.UploadableObject) string

func (Client) GetSignedURL

func (c Client) GetSignedURL(ctx context.Context, object blobstorage.UploadableObject, options ...blobstorage.Option) (string, error)

func (Client) ReadFile

func (c Client) ReadFile(ctx context.Context, object blobstorage.UploadableObject) (io.ReadCloser, error)

func (Client) SanitizeFilename

func (c Client) SanitizeFilename(filename string, timestamp int64) string

func (Client) UploadFile

func (c Client) UploadFile(ctx context.Context, object blobstorage.UploadableObject, fileReader io.Reader) (string, error)

type Config

type Config struct {
	BucketName string
	Path       string
	Cache      *redis.Client
}

type DefaultPublicUploadable

type DefaultPublicUploadable struct {
	Path string
}

func PublicUploadable

func PublicUploadable(fileLocation string) DefaultPublicUploadable

func (DefaultPublicUploadable) GetBucketName

func (p DefaultPublicUploadable) GetBucketName() string

func (DefaultPublicUploadable) GetFileLocation

func (p DefaultPublicUploadable) GetFileLocation() string

func (DefaultPublicUploadable) GetTimestamp

func (p DefaultPublicUploadable) GetTimestamp() int64

Jump to

Keyboard shortcuts

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