Documentation
¶
Index ¶
- func Client() (*minio.Client, error)
- func EnsureBucket(ctx context.Context, buckets ...string) error
- func Exists(ctx context.Context, objectKey string, opts ...*ExistsOptions) (bool, error)
- func Init() (err error)
- func List(ctx context.Context, opts ...*ListOptions) <-chan ObjectInfo
- func New(cfg config.Minio) (cli *minio.Client, err error)
- func PresignedGetURL(ctx context.Context, objectKey string, expires time.Duration, ...) (string, error)
- func PresignedPutURL(ctx context.Context, objectKey string, expires time.Duration, ...) (string, error)
- func Remove(ctx context.Context, objectKey string, opts ...*RemoveOptions) error
- type CopyOptions
- type ExistsOptions
- type GetOptions
- type ListOptions
- type ObjectInfo
- func Copy(ctx context.Context, srcKey, dstKey string, opts ...*CopyOptions) (*ObjectInfo, error)
- func Get(ctx context.Context, objectKey string, opts ...*GetOptions) (io.ReadCloser, *ObjectInfo, error)
- func Put(ctx context.Context, objectKey string, reader io.Reader, opts ...*PutOptions) (*ObjectInfo, error)
- func Stat(ctx context.Context, objectKey string, opts ...*StatOptions) (*ObjectInfo, error)
- type PutOptions
- type RemoveOptions
- type StatOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureBucket ¶ added in v0.10.5
EnsureBucket ensures that the bucket exists, creates it if not exists.
func Init ¶
func Init() (err error)
Init initializes the global MinIO client. It reads MinIO configuration from config.App.Minio. If MinIO is not enabled, it returns nil. The function is thread-safe and ensures the client is initialized only once.
func List ¶ added in v0.10.5
func List(ctx context.Context, opts ...*ListOptions) <-chan ObjectInfo
List lists objects under the prefix. Errors from listing are skipped.
func PresignedGetURL ¶ added in v0.10.5
func PresignedGetURL(ctx context.Context, objectKey string, expires time.Duration, opts ...*GetOptions) (string, error)
PresignedGetURL generates a presigned GET URL with expiration capped at 7 days.
func PresignedPutURL ¶ added in v0.10.5
func PresignedPutURL(ctx context.Context, objectKey string, expires time.Duration, opts ...*GetOptions) (string, error)
PresignedPutURL generates a presigned PUT URL with expiration capped at 7 days.
Types ¶
type CopyOptions ¶ added in v0.10.5
type CopyOptions struct {
Bucket string
}
CopyOptions configures object copy operations.
type ExistsOptions ¶ added in v0.10.5
ExistsOptions configures existence checks.
type GetOptions ¶ added in v0.10.5
type GetOptions struct {
VersionID string // object version ID when versioning is enabled
Range string // HTTP range header, e.g. "bytes=0-1024"
Bucket string // overwrite the bucket name set in config.
}
GetOptions represents download options.
type ListOptions ¶ added in v0.10.5
ListOptions configures object listing.
type ObjectInfo ¶ added in v0.10.5
type ObjectInfo struct {
Key string
Size int64
ContentType string
ETag string
LastModified time.Time
Metadata map[string]string
}
ObjectInfo describes object metadata.
func Copy ¶ added in v0.10.5
func Copy(ctx context.Context, srcKey, dstKey string, opts ...*CopyOptions) (*ObjectInfo, error)
Copy copies an object within the same bucket.
func Get ¶
func Get(ctx context.Context, objectKey string, opts ...*GetOptions) (io.ReadCloser, *ObjectInfo, error)
Get downloads an object and returns a reader plus metadata.
func Put ¶
func Put(ctx context.Context, objectKey string, reader io.Reader, opts ...*PutOptions) (*ObjectInfo, error)
Put uploads an object to MinIO and returns its basic metadata.
func Stat ¶ added in v0.10.5
func Stat(ctx context.Context, objectKey string, opts ...*StatOptions) (*ObjectInfo, error)
Stat returns object metadata.
type PutOptions ¶ added in v0.10.5
type PutOptions struct {
ContentType string // MIME type, auto-detected if empty
Metadata map[string]string // custom metadata
ContentEncoding string
CacheControl string
Bucket string // overwrite the bucket name set in config.
Size int64
}
PutOptions represents upload options.
type RemoveOptions ¶ added in v0.10.5
RemoveOptions configures delete behavior.
type StatOptions ¶ added in v0.10.5
StatOptions configures stat lookups.