minio

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client() (*minio.Client, error)

Client returns the global MinIO client or an error if it is not initialized.

func EnsureBucket added in v0.10.5

func EnsureBucket(ctx context.Context, buckets ...string) error

EnsureBucket ensures that the bucket exists, creates it if not exists.

func Exists added in v0.10.5

func Exists(ctx context.Context, objectKey string, opts ...*ExistsOptions) (bool, error)

Exists checks whether an object 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 New

func New(cfg config.Minio) (cli *minio.Client, err error)

New returns a new MinIO client with given configuration.

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.

func Remove added in v0.10.5

func Remove(ctx context.Context, objectKey string, opts ...*RemoveOptions) error

Remove deletes an object from MinIO.

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

type ExistsOptions struct {
	VersionID string
	Bucket    string
}

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

type ListOptions struct {
	Prefix    string
	Recursive bool
	Bucket    string
}

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

type RemoveOptions struct {
	ForceDelete bool
	VersionID   string
	Bucket      string
}

RemoveOptions configures delete behavior.

type StatOptions added in v0.10.5

type StatOptions struct {
	VersionID string
	Bucket    string
}

StatOptions configures stat lookups.

Jump to

Keyboard shortcuts

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