Documentation
¶
Overview ¶
Package minio provides a client for MinIO (S3-compatible) object storage.
Index ¶
- Constants
- Variables
- type Config
- type FileInfo
- type Minio
- func (a *Minio) Copy(ctx context.Context, ...) error
- func (a *Minio) CreateBucket(ctx context.Context, bucketName string) error
- func (a *Minio) Delete(ctx context.Context, bucketName string, fileID string) error
- func (a *Minio) Get(ctx context.Context, bucketName string, fileID string) (io.Reader, error)
- func (a *Minio) GetMetadata(ctx context.Context, bucketName string, fileID string) (*FileInfo, error)
- func (a *Minio) IsBucketExist(ctx context.Context, bucketName string) bool
- func (a *Minio) IsFileExist(ctx context.Context, bucketName string, fileID string) bool
- func (a *Minio) Put(ctx context.Context, fi *FileInfo, file io.Reader) error
Constants ¶
View Source
const ( ErrCodeErrMinioPutObject = "S3-001" ErrCodeMinioCannotGetObject = "S3-002" ErrCodeMinioCannotGetStatObject = "S3-003" ErrCodeMinioObjectNotFound = "S3-004" ErrCodeMinioCreateBucket = "S3-005" ErrCodeMinioRemoveObject = "S3-006" ErrCodeMinioNew = "S3-007" ErrCodeMinioCopyObject = "S3-008" )
Variables ¶
View Source
var ( ErrMinioPutObject = func(cause error, ctx context.Context) error { return jet.NewAppErrBuilder(ErrCodeErrMinioPutObject, "").Wrap(cause).C(ctx).Err() } ErrMinioCannotGetObject = func(cause error, ctx context.Context) error { return jet.NewAppErrBuilder(ErrCodeMinioCannotGetObject, "").Wrap(cause).C(ctx).Err() } ErrMinioCannotGetStatObject = func(cause error, ctx context.Context) error { return jet.NewAppErrBuilder(ErrCodeMinioCannotGetStatObject, "").Wrap(cause).C(ctx).Err() } ErrMinioObjectNotFound = func(ctx context.Context) error { return jet.NewAppErrBuilder(ErrCodeMinioObjectNotFound, "").C(ctx).Err() } ErrMinioCreateBucket = func(cause error, ctx context.Context) error { return jet.NewAppErrBuilder(ErrCodeMinioCreateBucket, "").Wrap(cause).C(ctx).Err() } ErrMinioRemoveObject = func(cause error, ctx context.Context, fileId string) error { return jet.NewAppErrBuilder(ErrCodeMinioRemoveObject, "").Wrap(cause).C(ctx).F(jet.KV{"fileID ": fileId}).Err() } ErrMinioCopyObject = func(cause error, ctx context.Context, fileId string) error { return jet.NewAppErrBuilder(ErrCodeMinioCopyObject, "").Wrap(cause).C(ctx).F(jet.KV{"fileID ": fileId}).Err() } ErrMinioNew = func(cause error) error { return jet.NewAppErrBuilder(ErrCodeMinioNew, "").Wrap(cause).Err() } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string
Port string
AccessKey string `config:"access-key"`
SecretKey string `config:"secret-key"`
Ssl bool
}
Config minio config
type FileInfo ¶
type FileInfo struct {
Id string `json:"id"` // Id file ID
Filename string `json:"fileName"` // Filename - file name
BucketName string `json:"bucket"` // BucketName - bucket name (like storage folder)
Extension string `json:"ext"` // Extension - file ext
LastModified string `json:"modified"` // LastModified - last modified date
Size int64 `json:"size"` // Size - length of a file in bytes
ContentType string `json:"contentType"` // ContentType - content type
Metadata map[string]string `json:"metadata"` // Metadata - some additional user params attached to a stored file
}
FileInfo is a meta info about stored file
type Minio ¶
func (*Minio) CreateBucket ¶
func (*Minio) GetMetadata ¶
func (*Minio) IsBucketExist ¶
func (*Minio) IsFileExist ¶
Click to show internal directories.
Click to hide internal directories.