storage

package
v0.0.0-...-5c85971 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageService

type StorageService struct {
	Client     *storage.Client
	BucketName string
}

StorageService encapsulates the Google Cloud Storage client and related operations.

func NewStorageService

func NewStorageService(ctx context.Context, bucketName, credentialsPath string) (*StorageService, error)

NewStorageService initializes a new storage service with the provided Google Cloud Storage bucket.

func (*StorageService) DeleteFile

func (s *StorageService) DeleteFile(ctx context.Context, filePath string) error

DeleteFile deletes a file from cloud storage.

func (*StorageService) GetFileMetadata

func (s *StorageService) GetFileMetadata(ctx context.Context, filePath string) (*storage.ObjectAttrs, error)

GetFileMetadata retrieves metadata of a file stored in cloud storage.

func (*StorageService) ListImages

func (s *StorageService) ListImages(ctx context.Context) ([]string, error)

ListImages retrieves a list of image URLs from the cloud storage.

func (*StorageService) UploadFile

func (s *StorageService) UploadFile(ctx context.Context, filePath string, fileData io.Reader) (string, error)

UploadFile uploads any file to the cloud storage and returns its URL.

Jump to

Keyboard shortcuts

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