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 ¶
Types ¶
type Filesystem ¶
type Filesystem struct { IStorage // contains filtered or unexported fields }
func (*Filesystem) Delete ¶
func (s *Filesystem) Delete(ctx context.Context, filePathIn string) error
func (*Filesystem) Get ¶
func (s *Filesystem) Get(ctx context.Context, filePathIn string) (IObject, IObjectInfo, error)
func (*Filesystem) Stat ¶
func (s *Filesystem) Stat(ctx context.Context, filePathIn string) (IObjectInfo, error)
func (*Filesystem) WithPrefix ¶
func (s *Filesystem) WithPrefix(prefix string) (IStorage, error)
type IObjectInfo ¶
type IStorage ¶
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) }
type ObjectInfo ¶
type ObjectInfo struct {
// contains filtered or unexported fields
}
func (*ObjectInfo) GetContentType ¶
func (o *ObjectInfo) GetContentType() string
func (*ObjectInfo) GetExpiration ¶
func (o *ObjectInfo) GetExpiration() time.Time
func (*ObjectInfo) GetExtension ¶
func (o *ObjectInfo) GetExtension() string
func (*ObjectInfo) GetFileInfo ¶
func (o *ObjectInfo) GetFileInfo() *FileInfo
func (*ObjectInfo) GetLastModified ¶
func (o *ObjectInfo) GetLastModified() time.Time
func (*ObjectInfo) GetName ¶
func (o *ObjectInfo) GetName() string
func (*ObjectInfo) GetSize ¶
func (o *ObjectInfo) GetSize() int64
type S3 ¶
type S3 struct { IStorage // contains filtered or unexported fields }
func (*S3) Put ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.