storage

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedProviderType = errors.New("unsupported storage provider type")
)

Functions

This section is empty.

Types

type File

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

File implements the Storage interface for a local file storage provider.

func NewFile

func NewFile(c FileConfig) (*File, error)

func (*File) BucketExists

func (t *File) BucketExists(name string) (bool, error)

func (*File) CreateBucket

func (t *File) CreateBucket(name string, location ...string) error

func (*File) CreateBucketIfNotExists

func (t *File) CreateBucketIfNotExists(name string, location ...string) error

func (*File) DeleteObject

func (t *File) DeleteObject(bucketName, objectName string) error

func (*File) GetObject

func (t *File) GetObject(bucketName string, objectName string) (io.ReadCloser, int64, error)

func (*File) PutObject

func (t *File) PutObject(
	bucketName string,
	objectName string,
	reader io.Reader,
	objectSize int64,
	mimeType string,
) error

type FileConfig

type FileConfig struct {
	BasePath string
}

type IStorage

type IStorage interface {
	BucketExists(name string) (bool, error)
	CreateBucket(name string, location ...string) error
	CreateBucketIfNotExists(name string, location ...string) error

	PutObject(bucketName, objectName string, reader io.Reader, objectSize int64, mimeType string) error
	GetObject(bucketName, objectName string) (io.ReadCloser, int64, error)
	DeleteObject(bucketName, objectName string) error
}

func New

func New(c StorageConfig) (IStorage, error)

type Minio

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

Minio implements the Storage interface for the MinIO SDK to connect to a MinIO instance, Amazon S3 or Google Cloud.

func NewMinio

func NewMinio(c MinioConfig) (*Minio, error)

func (*Minio) BucketExists

func (t *Minio) BucketExists(name string) (bool, error)

func (*Minio) CreateBucket

func (t *Minio) CreateBucket(name string, location ...string) error

func (*Minio) CreateBucketIfNotExists

func (t *Minio) CreateBucketIfNotExists(name string, location ...string) error

func (*Minio) DeleteObject

func (t *Minio) DeleteObject(bucketName, objectName string) error

func (*Minio) GetObject

func (t *Minio) GetObject(bucketName, objectName string) (io.ReadCloser, int64, error)

func (*Minio) PutObject

func (t *Minio) PutObject(
	bucketName string,
	objectName string,
	reader io.Reader,
	objectSize int64,
	mimeType string,
) error

type MinioConfig

type MinioConfig struct {
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
	Location        string
	Secure          bool
}

type StorageConfig

type StorageConfig struct {
	Type  string
	Minio MinioConfig
	File  FileConfig
}

Jump to

Keyboard shortcuts

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