storage

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 17 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

SPDX-License-Identifier: AGPL-3.0-or-later

Index

Constants

This section is empty.

Variables

View Source
var AllowedMIMETypes = map[string]bool{
	"application/pdf":    true,
	"image/png":          true,
	"image/jpeg":         true,
	"image/gif":          true,
	"image/webp":         true,
	"image/svg+xml":      true,
	"text/plain":         true,
	"text/html":          true,
	"text/markdown":      true,
	"text/x-markdown":    true,
	"application/msword": true,
	"application/vnd.openxmlformats-officedocument.wordprocessingml.document": true,
	"application/vnd.ms-excel": true,
	"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": true,
	"application/vnd.oasis.opendocument.text":                           true,
	"application/vnd.oasis.opendocument.spreadsheet":                    true,
}

Functions

func IsAllowedMIMEType

func IsAllowedMIMEType(mimeType string) bool

Types

type FileInfo

type FileInfo struct {
	Key         string
	Size        int64
	ContentType string
}

type LocalProvider

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

func NewLocalProvider

func NewLocalProvider(basePath string) (*LocalProvider, error)

func (*LocalProvider) Delete

func (p *LocalProvider) Delete(ctx context.Context, key string) error

func (*LocalProvider) Download

func (p *LocalProvider) Download(ctx context.Context, key string) (io.ReadCloser, int64, string, error)

func (*LocalProvider) Exists

func (p *LocalProvider) Exists(ctx context.Context, key string) (bool, error)

func (*LocalProvider) Type

func (p *LocalProvider) Type() string

func (*LocalProvider) Upload

func (p *LocalProvider) Upload(ctx context.Context, key string, reader io.Reader, size int64, contentType string) error

type Provider

type Provider interface {
	Upload(ctx context.Context, key string, reader io.Reader, size int64, contentType string) error
	Download(ctx context.Context, key string) (io.ReadCloser, int64, string, error)
	Delete(ctx context.Context, key string) error
	Exists(ctx context.Context, key string) (bool, error)
	Type() string
}

func NewProvider

func NewProvider(cfg config.StorageConfig) (Provider, error)

type S3Config

type S3Config struct {
	Endpoint  string
	Bucket    string
	AccessKey string
	SecretKey string
	Region    string
	UseSSL    bool
}

type S3Provider

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

func NewS3Provider

func NewS3Provider(cfg S3Config) (*S3Provider, error)

func (*S3Provider) Delete

func (p *S3Provider) Delete(ctx context.Context, key string) error

func (*S3Provider) Download

func (p *S3Provider) Download(ctx context.Context, key string) (io.ReadCloser, int64, string, error)

func (*S3Provider) Exists

func (p *S3Provider) Exists(ctx context.Context, key string) (bool, error)

func (*S3Provider) Type

func (p *S3Provider) Type() string

func (*S3Provider) Upload

func (p *S3Provider) Upload(ctx context.Context, key string, reader io.Reader, size int64, contentType string) error

Jump to

Keyboard shortcuts

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