storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Provider string      `yaml:"provider"`
	S3       *s3.Config  `yaml:"s3,omitempty"`
	GCS      *gcs.Config `yaml:"gcs,omitempty"`

	LocalPath string `yaml:"localPath,omitempty"`
	BaseURL   string `yaml:"baseUrl,omitempty"`
}

func (*Config) Key

func (c *Config) Key() string

func (*Config) Validate

func (c *Config) Validate() error

type Module

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

func New

func New() *Module

func (*Module) Configure

func (m *Module) Configure(config config.Config) error

Configure updates the module configuration

func (*Module) Delete

func (m *Module) Delete(ctx context.Context, path string) error

Delete removes a file through the configured provider

func (*Module) Dependencies

func (m *Module) Dependencies() []string

Dependencies returns the module dependencies

func (*Module) Download

func (m *Module) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download retrieves file content through the configured provider

func (*Module) GetMigrationSources

func (m *Module) GetMigrationSources(projectRoot string) []migration_runner.Source

GetMigrationSources returns the migration sources for the storage module

func (*Module) Initialize

func (m *Module) Initialize(
	ctx context.Context,
	db *gorm.DB,
	router *gin.Engine,
) error

Initialize sets up the storage module

func (*Module) List

func (m *Module) List(ctx context.Context, prefix string) ([]models.FileInfo, error)

List returns files in a directory through the configured provider

func (*Module) MigrationsDir

func (m *Module) MigrationsDir() string

MigrationsDir implements module.Module.

func (*Module) Name

func (m *Module) Name() string

Name returns the module name

func (*Module) Namespace

func (m *Module) Namespace() module.ModuleNamespace

Namespace implements module.Module.

func (*Module) NewConfig

func (m *Module) NewConfig() config.Config

NewConfig implements module.Module.

func (*Module) ProvidesMigrations

func (m *Module) ProvidesMigrations() bool

ProvidesMigrations implements module.Module.

func (*Module) Shutdown

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

Shutdown cleans up resources

func (*Module) Upload

func (m *Module) Upload(ctx context.Context, input *models.UploadInput) (*models.UploadOutput, error)

Upload handles file upload through the configured provider

func (*Module) Version

func (m *Module) Version() string

Version returns the module version

type StorageProvider

type StorageProvider interface {
	// Upload handles file upload with idempotency
	Upload(ctx context.Context, input *models.UploadInput) (*models.UploadOutput, error)

	// Download retrieves file content
	Download(ctx context.Context, path string) (io.ReadCloser, error)

	// Delete removes a file
	Delete(ctx context.Context, path string) error

	// List returns files in a directory
	List(ctx context.Context, prefix string) ([]models.FileInfo, error)
}

StorageProvider defines the interface for storage operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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