storage

package
v0.0.0-...-0940e79 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilePrefix

type FilePrefix string
const (
	IconPrefix FilePrefix = "icon"
)

type IStorage

type IStorage interface {
	IsExisted(ctx context.Context, key string) (bool, error)
	FetchMetadata(c context.Context, key string) (map[string]string, error)
	CopyObject(c context.Context, sourceKey string, destKey string, metadata map[string]string) error
	DeleteObject(c context.Context, key string) error
	CommitFileUploaded(c context.Context, key string, parent string, target string, prefix FilePrefix) (string, func(*string) error, func() error, error)
}

func NewIStorage

func NewIStorage() IStorage

type S3

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

func (*S3) CommitFileUploaded

func (s *S3) CommitFileUploaded(c context.Context, key string, parent string, target string, prefix FilePrefix) (string, func(*string) error, func() error, error)

func (*S3) CopyObject

func (s *S3) CopyObject(c context.Context, sourceKey string, destKey string, metadata map[string]string) error

func (*S3) DeleteObject

func (s *S3) DeleteObject(c context.Context, key string) error

func (*S3) FetchMetadata

func (s *S3) FetchMetadata(c context.Context, key string) (map[string]string, error)

func (*S3) Init

func (s *S3) Init(ctx context.Context) (*gobs.ServiceLifeCycle, error)

func (*S3) IsExisted

func (s *S3) IsExisted(ctx context.Context, key string) (bool, error)

func (*S3) Setup

func (s *S3) Setup(ctx context.Context, deps ...gobs.IService) error

type S3Config

type S3Config struct {
	AccessKey string `env:"S3_ACCESS_KEY" mapstructure:"S3_ACCESS_KEY"`
	SecretKey string `env:"S3_SECRET_KEY" mapstructure:"S3_SECRET_KEY"`
	Region    string `env:"S3_REGION" mapstructure:"S3_REGION"`
	Bucket    string `env:"S3_BUCKET_NAME" mapstructure:"S3_BUCKET_NAME"`
	URI       string `env:"S3_URI" mapstructure:"S3_URI"`
}

Jump to

Keyboard shortcuts

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