storage

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewR2StorageService

func NewR2StorageService(accountID, accessKeyID, accessKeySecret, bucketName string, isPublic bool) interfaces.StorageService

NewR2StorageService creates a StorageService configured for Cloudflare R2

func NewS3StorageService

func NewS3StorageService(awsRegion, accessKeyID, accessKeySecret, bucketName string, isPublic bool) interfaces.StorageService

NewS3StorageService creates a StorageService configured for AWS S3

func NewStorageService

func NewStorageService(client aws_client.S3Client, config StorageConfig) interfaces.StorageService

NewStorageService creates a new object storage service

Types

type ObjectStorageService

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

ObjectStorageService implements StorageService using S3Client

func (*ObjectStorageService) Delete

func (s *ObjectStorageService) Delete(ctx context.Context, key string) error

Delete removes an object from storage

func (*ObjectStorageService) Download

func (s *ObjectStorageService) Download(ctx context.Context, key string) ([]byte, error)

Download retrieves data from object storage

func (*ObjectStorageService) GetPublicURL

func (s *ObjectStorageService) GetPublicURL(key string) string

GetPublicURL returns a public URL for the object

func (*ObjectStorageService) Upload

func (s *ObjectStorageService) Upload(ctx context.Context, key string, data []byte, contentType string) error

Upload stores data in object storage

type StorageConfig

type StorageConfig struct {
	BucketName string
	IsPublic   bool   // Whether objects should be publicly accessible
	CDNDomain  string // Optional CDN domain for public URLs
}

StorageConfig holds configuration for object storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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