s3

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package s3 provides a client for Amazon S3 (and S3-compatible) object storage.

Index

Constants

View Source
const (
	ErrCodeS3PresignPutObject = "S3-001"
	ErrCodeS3DeleteObject     = "S3-002"
	ErrCodeS3GetObject        = "S3-003"
	ErrCodeS3UrlBuildFailed   = "S3-004"
)

Variables

View Source
var (
	ErrS3PresignPutObject = func(ctx context.Context, cause error) error {
		return jet.NewAppErrBuilder(ErrCodeS3PresignPutObject, "presign put object").C(ctx).Wrap(cause).Err()
	}
	ErrS3DeleteObject = func(ctx context.Context, cause error) error {
		return jet.NewAppErrBuilder(ErrCodeS3DeleteObject, "delete object").C(ctx).Wrap(cause).Err()
	}
	ErrS3GetObject = func(ctx context.Context, cause error) error {
		return jet.NewAppErrBuilder(ErrCodeS3GetObject, "get object").C(ctx).Wrap(cause).Err()
	}
	ErrS3UrlBuildFailed = func(ctx context.Context, cause error) error {
		return jet.NewAppErrBuilder(ErrCodeS3UrlBuildFailed, "url build failed").C(ctx).Wrap(cause).Err()
	}
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(awsCfg *jetaws.Config, s3Cfg *Config, logger jet.CLoggerFunc) *Client

func (*Client) DeleteFileByKey

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

func (*Client) GetFileByKey

func (c *Client) GetFileByKey(ctx context.Context, private bool, key string) (io.ReadCloser, error)
func (c *Client) GetGetFileLink(ctx context.Context, private bool, key string) (string, error)
func (c *Client) GetNewFileUploadLink(ctx context.Context, private, withPrefix bool, ownerId, fileName, category string) (string, string, error)
func (c *Client) GetUpdateFileUploadLink(ctx context.Context, private bool, key string) (string, error)

func (*Client) Init

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

type Config

type Config struct {
	PublicBucketName            string `mapstructure:"public_bucket_name"`
	PublicBucketUploadQueueName string `mapstructure:"public_bucket_upload_queue_name"`
	PrivateBucketName           string `mapstructure:"private_bucket_name"`
	PrivateBucketUploadQueue    string `mapstructure:"private_bucket_upload_queue_name"`
	PresignedLinkTTL            int64  `mapstructure:"presigned_link_ttl"`
}

Jump to

Keyboard shortcuts

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