Documentation
¶
Overview ¶
Package storage provides file storage abstractions for minimaldoc-server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
ID string
Filename string
ContentType string
Size int64
StoragePath string
URL string
UploadedAt time.Time
}
File represents an uploaded file.
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage implements Storage using the local filesystem.
func NewLocalStorage ¶
func NewLocalStorage(cfg config.StorageConfig) (*LocalStorage, error)
NewLocalStorage creates a local filesystem storage provider.
func (*LocalStorage) Delete ¶
func (s *LocalStorage) Delete(ctx context.Context, path string) error
Delete removes a file from the local filesystem.
func (*LocalStorage) URL ¶
func (s *LocalStorage) URL(path string) string
URL returns the public URL for a storage path.
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements Storage using S3-compatible object storage.
type Storage ¶
type Storage interface {
// Upload stores a file and returns its public URL.
Upload(ctx context.Context, filename string, contentType string, reader io.Reader) (url string, path string, err error)
// Delete removes a file by its storage path.
Delete(ctx context.Context, path string) error
// URL returns the public URL for a storage path.
URL(path string) string
}
Storage defines the interface for file storage operations.
func New ¶
func New(cfg config.StorageConfig) (Storage, error)
New creates a storage provider based on configuration.
func NewS3Storage ¶
func NewS3Storage(cfg config.StorageConfig) (Storage, error)
NewS3Storage creates an S3 storage provider.
Click to show internal directories.
Click to hide internal directories.