Documentation
¶
Index ¶
- type GCSStorage
- func (g *GCSStorage) Delete(ctx context.Context, bucketName, objectName string) error
- func (g *GCSStorage) Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
- func (g *GCSStorage) GetSignedURL(ctx context.Context, bucketName, objectName string, method string, ...) (string, error)
- func (g *GCSStorage) Upload(ctx context.Context, bucketName, objectName string, file io.Reader) (string, error)
- type GCSStorageConfig
- type LocalStorage
- func (l *LocalStorage) Delete(ctx context.Context, bucketName, objectName string) error
- func (l *LocalStorage) Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
- func (l *LocalStorage) GetSignedURL(ctx context.Context, bucketName, objectName string, method string, ...) (string, error)
- func (l *LocalStorage) Upload(ctx context.Context, bucketName, objectName string, file io.Reader) (string, error)
- type LocalStorageConfig
- type S3Storage
- func (s *S3Storage) Delete(ctx context.Context, bucketName, objectName string) error
- func (s *S3Storage) Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
- func (s *S3Storage) GetSignedURL(ctx context.Context, bucketName, objectName string, method string, ...) (string, error)
- func (s *S3Storage) Upload(ctx context.Context, bucketName, objectName string, file io.Reader) (string, error)
- type S3StorageConfig
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCSStorage ¶
type GCSStorage struct {
// contains filtered or unexported fields
}
GCSStorage implements the Storage interface for Google Cloud Storage.
func NewGCSStorage ¶
func NewGCSStorage(ctx context.Context, cfg GCSStorageConfig) (*GCSStorage, error)
NewGCSStorage creates a new GCSStorage instance.
func (*GCSStorage) Delete ¶
func (g *GCSStorage) Delete(ctx context.Context, bucketName, objectName string) error
Delete removes a file from GCS.
func (*GCSStorage) Download ¶
func (g *GCSStorage) Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
Download retrieves a file from GCS.
func (*GCSStorage) GetSignedURL ¶
func (g *GCSStorage) GetSignedURL(ctx context.Context, bucketName, objectName string, method string, durationMinutes int) (string, error)
GetSignedURL generates a signed URL for GCS.
type GCSStorageConfig ¶
type GCSStorageConfig struct {
ProjectID string `mapstructure:"project_id"`
Bucket string `mapstructure:"bucket"`
CredentialsFile string `mapstructure:"credentials_file"`
}
GCSStorageConfig holds configuration for GCS storage.
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage implements the Storage interface for local file system.
func NewLocalStorage ¶
func NewLocalStorage(cfg LocalStorageConfig) (*LocalStorage, error)
NewLocalStorage creates a new LocalStorage instance.
func (*LocalStorage) Delete ¶
func (l *LocalStorage) Delete(ctx context.Context, bucketName, objectName string) error
Delete removes a file from the local file system.
func (*LocalStorage) Download ¶
func (l *LocalStorage) Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
Download retrieves a file from the local file system.
func (*LocalStorage) GetSignedURL ¶
func (l *LocalStorage) GetSignedURL(ctx context.Context, bucketName, objectName string, method string, durationMinutes int) (string, error)
GetSignedURL generates a signed URL for local storage. This is a placeholder as local storage doesn't inherently support signed URLs.
type LocalStorageConfig ¶
type LocalStorageConfig struct {
BasePath string `mapstructure:"base_path"`
}
LocalStorageConfig holds configuration for local storage.
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements the Storage interface for AWS S3.
func NewS3Storage ¶
func NewS3Storage(cfg S3StorageConfig) (*S3Storage, error)
NewS3Storage creates a new S3Storage instance.
func (*S3Storage) Download ¶
func (s *S3Storage) Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
Download retrieves a file from S3.
type S3StorageConfig ¶
type S3StorageConfig struct {
Region string `mapstructure:"region"`
AccessKeyID string `mapstructure:"access_key_id"`
SecretAccessKey string `mapstructure:"secret_access_key"`
Bucket string `mapstructure:"bucket"`
}
S3StorageConfig holds configuration for S3 storage.
type Storage ¶
type Storage interface {
Upload(ctx context.Context, bucketName, objectName string, file io.Reader) (string, error)
Download(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
Delete(ctx context.Context, bucketName, objectName string) error
GetSignedURL(ctx context.Context, bucketName, objectName string, method string, durationMinutes int) (string, error)
}
Storage defines the interface for file storage operations.
func NewStorage ¶
NewStorage creates a new Storage implementation based on the provided configuration.