storage

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Type StorageType `envconfig:"TYPE" validate:"oneof=disk s3"`

	Disk struct {
		RootDir string `envconfig:"ROOT_DIR"`
	} `envconfig:"DISK"`

	S3 struct {
		BucketName string `envconfig:"BUCKET_NAME"`
		Region     string `default:"ap-northeast-1" envconfig:"REGION"`
	} `envconfig:"S3"`
}

type Storage

type Storage interface {
	Save(ctx context.Context, filePath string, data []byte, opts ...option.SaveOptionFunc) (string, error)
	Get(ctx context.Context, filePath string) ([]byte, error)
	Delete(ctx context.Context, filePath string) error
	Ping(ctx context.Context) error
}

func NewStorage

func NewStorage(serviceName string, conf *Config) (Storage, error)

type StorageType

type StorageType string
const (
	StorageTypeDisk StorageType = "disk"
	StorageTypeS3   StorageType = "s3"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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