storage

package
v0.0.0-...-92dca13 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GC3Storage

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

GC3Storage struct to hold the Google Cloud Storage client and bucket details

func NewGC3Storage

func NewGC3Storage(ctx context.Context, credentialsFile, bucket string) (*GC3Storage, error)

NewGC3Storage initializes a new Google Cloud Storage client

func (*GC3Storage) DeleteFile

func (g *GC3Storage) DeleteFile(ctx context.Context, filePath string) error

DeleteFile deletes a file from Google Cloud Storage

func (*GC3Storage) UploadFile

func (g *GC3Storage) UploadFile(ctx context.Context, file *multipart.FileHeader, destination string) (string, error)

UploadFile uploads a file to Google Cloud Storage

type S3Storage

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

S3Storage struct to hold the S3 client and bucket details

func NewS3Storage

func NewS3Storage(accessKey, secretKey, region, bucket string) (*S3Storage, error)

NewS3Storage initializes a new S3 client

func (*S3Storage) DeleteFile

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

DeleteFile deletes a file from S3

func (*S3Storage) UploadFile

func (s *S3Storage) UploadFile(ctx context.Context, file *multipart.FileHeader, destination string) (string, error)

UploadFile uploads a file to S3

type Storage

type Storage interface {
	UploadFile(ctx context.Context, file *multipart.FileHeader, destination string) (string, error)
	DeleteFile(ctx context.Context, filePath string) error
}

Storage interface that both S3 and GC3 will implement

Jump to

Keyboard shortcuts

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