[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
38
backend/internal/storage/storage.go
Normal file
38
backend/internal/storage/storage.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package storage
|
||||
|
||||
//go:generate mockgen -source=storage.go -destination=mock/mock_storage.go -package=mock
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
// FileInfo represents metadata about a stored file
|
||||
type FileInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Size int64 `json:"size"`
|
||||
ContentType string `json:"content_type"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// Storage defines the interface for file storage operations
|
||||
type Storage interface {
|
||||
// Save stores a file and returns its FileInfo
|
||||
Save(ctx context.Context, name string, contentType string, reader io.Reader) (*FileInfo, error)
|
||||
|
||||
// Get retrieves a file by its ID
|
||||
Get(ctx context.Context, id string) (io.ReadCloser, *FileInfo, error)
|
||||
|
||||
// Delete removes a file by its ID
|
||||
Delete(ctx context.Context, id string) error
|
||||
|
||||
// List returns a list of files with optional prefix
|
||||
List(ctx context.Context, prefix string, limit int, offset int) ([]*FileInfo, error)
|
||||
|
||||
// Exists checks if a file exists
|
||||
Exists(ctx context.Context, id string) (bool, error)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue