storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudProvider

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

CloudProvider implements ObjectStorage using local filesystem and memory fallbacks, avoiding external heavy cloud SDK dependencies.

func NewCloudProvider

func NewCloudProvider(ctx context.Context, bucketURL string) (*CloudProvider, error)

NewCloudProvider creates a new CloudProvider from a bucket URL. Example URLs: - Mem: mem:// - Local: file:///path/to/dir (use file:///C:/path on Windows) - Fallback relative/absolute directory path: ./uploads

func (*CloudProvider) Close

func (p *CloudProvider) Close() error

Close releases any resources.

func (*CloudProvider) Delete

func (p *CloudProvider) Delete(ctx context.Context, path string) error

Delete removes a file from storage.

func (*CloudProvider) GetURL

func (p *CloudProvider) GetURL(ctx context.Context, path string) (string, error)

GetURL returns a public or signed URL for a file.

func (*CloudProvider) Open

func (p *CloudProvider) Open(ctx context.Context, path string) (io.ReadCloser, error)

Open retrieves a file from storage.

func (*CloudProvider) Upload

func (p *CloudProvider) Upload(ctx context.Context, path string, data io.Reader) (string, error)

Upload saves a file to storage and returns its path or URL.

type Module

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

Module implements the mdk.Module interface for Storage.

func NewModule

func NewModule() *Module

NewModule creates a new Storage module.

func (*Module) ID

func (m *Module) ID() string

ID returns the unique identifier for the module.

func (*Module) Init

func (m *Module) Init(ctx context.Context, rt mdk.Runtime) error

Init initializes the module.

func (*Module) Models

func (m *Module) Models() []any

Models returns the GORM models owned by this module.

func (*Module) Provider

func (m *Module) Provider() ObjectStorage

Provider returns the underlying storage provider.

func (*Module) Routes

func (m *Module) Routes() []mdk.Route

Routes returns the HTTP routes provided by this module.

func (*Module) Shutdown

func (m *Module) Shutdown(ctx context.Context) error

Shutdown releases storage resources.

type ObjectStorage

type ObjectStorage = mdk.ObjectStorage

ObjectStorage defines the contract for OS-level file handling.

Jump to

Keyboard shortcuts

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