storage

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxFileSize     = 5 * 1024 * 1024 // 5 MB
	PresignedExpiry = 15 * time.Minute
	DownloadExpiry  = 1 * time.Hour
)

Variables

View Source
var AllowedContentTypes = map[string]bool{
	"image/jpeg": true,
	"image/png":  true,
	"image/webp": true,
}

Functions

func ValidateContentType

func ValidateContentType(contentType string) error

ValidateContentType checks if the content type is allowed

func ValidateFileSize

func ValidateFileSize(size int) error

ValidateFileSize checks if the file size is within limits

Types

type Client

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

Client wraps S3-compatible storage operations

func NewClient

func NewClient(cfg *appconfig.StorageConfig) (*Client, error)

NewClient creates a new storage client using AWS SDK v2

func (*Client) DeleteObject

func (c *Client) DeleteObject(ctx context.Context, key string) error

DeleteObject deletes an object from storage

func (*Client) GeneratePresignedGetURL

func (c *Client) GeneratePresignedGetURL(ctx context.Context, key string) (string, error)

GeneratePresignedGetURL generates a presigned URL for downloading

func (*Client) GeneratePresignedPutURL

func (c *Client) GeneratePresignedPutURL(ctx context.Context, key, contentType string) (string, error)

GeneratePresignedPutURL generates a presigned URL for uploading

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context) error

HealthCheck performs a health check on the storage

func (*Client) ObjectExists

func (c *Client) ObjectExists(ctx context.Context, key string) (bool, error)

ObjectExists checks if an object exists

Jump to

Keyboard shortcuts

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