Documentation ¶
Index ¶
- Variables
- func FileNameSplitter(fileName string) string
- func GetFilename(uid string, fileName string, fileExtension string) string
- type FileInfo
- type Filesystem
- func (s *Filesystem) Delete(ctx context.Context, filePathIn string) error
- func (s *Filesystem) Get(ctx context.Context, filePathIn string) (IObject, IObjectInfo, error)
- func (s *Filesystem) List(ctx context.Context, filePathIn string, offset int, pageSize int) ([]*FileInfo, error)
- func (s *Filesystem) Put(ctx context.Context, filePathIn string, reader io.Reader, size int64, ...) (string, error)
- func (s *Filesystem) Stat(ctx context.Context, filePathIn string) (IObjectInfo, error)
- func (s *Filesystem) WithPrefix(prefix string) (IStorage, error)
- type IObject
- type IObjectInfo
- type IStorage
- type Noop
- func (s *Noop) Delete(ctx context.Context, filePath string) error
- func (s *Noop) Get(ctx context.Context, filePath string) (IObject, IObjectInfo, error)
- func (s *Noop) List(ctx context.Context, filePath string, offset int, pageSize int) ([]*FileInfo, error)
- func (s *Noop) Put(ctx context.Context, filePath string, reader io.Reader, size int64, ...) (string, error)
- func (s *Noop) Stat(ctx context.Context, filePath string) (IObjectInfo, error)
- func (s *Noop) WithPrefix(prefix string) (IStorage, error)
- type ObjectInfo
- func (o *ObjectInfo) GetContentType() string
- func (o *ObjectInfo) GetExpiration() time.Time
- func (o *ObjectInfo) GetExtension() string
- func (o *ObjectInfo) GetFileInfo() *FileInfo
- func (o *ObjectInfo) GetLastModified() time.Time
- func (o *ObjectInfo) GetName() string
- func (o *ObjectInfo) GetSize() int64
- type Params
- type S3
- func (s *S3) Delete(ctx context.Context, filePathIn string) error
- func (s *S3) Get(ctx context.Context, filePathIn string) (IObject, IObjectInfo, error)
- func (s *S3) List(ctx context.Context, filePathIn string, offset int, pageSize int) ([]*FileInfo, error)
- func (s *S3) Put(ctx context.Context, filePathIn string, reader io.Reader, size int64, ...) (string, error)
- func (s *S3) PutWithTTL(ctx context.Context, filePathIn string, reader io.Reader, size int64, ...) (string, error)
- func (s *S3) Stat(ctx context.Context, filePathIn string) (IObjectInfo, error)
- func (s *S3) WithPrefix(prefix string) (IStorage, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("file not found") ErrInvalidPath = errors.New("invalid file path") )
Functions ¶
func FileNameSplitter ¶ added in v0.8.20
Types ¶
type Filesystem ¶ added in v0.8.20
type Filesystem struct { IStorage // contains filtered or unexported fields }
func (*Filesystem) Delete ¶ added in v0.8.20
func (s *Filesystem) Delete(ctx context.Context, filePathIn string) error
func (*Filesystem) Get ¶ added in v0.8.20
func (s *Filesystem) Get(ctx context.Context, filePathIn string) (IObject, IObjectInfo, error)
func (*Filesystem) Stat ¶ added in v0.8.20
func (s *Filesystem) Stat(ctx context.Context, filePathIn string) (IObjectInfo, error)
func (*Filesystem) WithPrefix ¶ added in v0.8.20
func (s *Filesystem) WithPrefix(prefix string) (IStorage, error)
type IObjectInfo ¶ added in v0.8.20
type IStorage ¶ added in v0.8.20
type IStorage interface { WithPrefix(prefix string) (IStorage, error) Get(ctx context.Context, filePath string) (IObject, IObjectInfo, error) Stat(ctx context.Context, filePath string) (IObjectInfo, error) Put(ctx context.Context, filePath string, reader io.Reader, size int64, contentType string) (string, error) Delete(ctx context.Context, filePath string) error List(ctx context.Context, filePath string, offset int, pageSize int) ([]*FileInfo, error) }
func NewFilesystem ¶ added in v0.8.20
type Noop ¶ added in v0.8.21
type Noop struct{}
type ObjectInfo ¶ added in v0.8.20
type ObjectInfo struct {
// contains filtered or unexported fields
}
func (*ObjectInfo) GetContentType ¶ added in v0.8.20
func (o *ObjectInfo) GetContentType() string
func (*ObjectInfo) GetExpiration ¶ added in v0.8.20
func (o *ObjectInfo) GetExpiration() time.Time
func (*ObjectInfo) GetExtension ¶ added in v0.8.20
func (o *ObjectInfo) GetExtension() string
func (*ObjectInfo) GetFileInfo ¶ added in v0.8.21
func (o *ObjectInfo) GetFileInfo() *FileInfo
func (*ObjectInfo) GetLastModified ¶ added in v0.8.21
func (o *ObjectInfo) GetLastModified() time.Time
func (*ObjectInfo) GetName ¶ added in v0.8.21
func (o *ObjectInfo) GetName() string
func (*ObjectInfo) GetSize ¶ added in v0.8.20
func (o *ObjectInfo) GetSize() int64
type S3 ¶ added in v0.8.20
type S3 struct { IStorage // contains filtered or unexported fields }
func (*S3) Put ¶ added in v0.8.20
func (s *S3) Put(ctx context.Context, filePathIn string, reader io.Reader, size int64, contentType string) (string, error)
Put the file path must end with a file extension (e.g., `jpg`, `png`)
func (*S3) PutWithTTL ¶ added in v0.8.20
Click to show internal directories.
Click to hide internal directories.