Documentation ¶
Index ¶
- Constants
- Variables
- type ExternalStorage
- type S3Storage
- func (s *S3Storage) DeleteFile(filePath string) error
- func (s *S3Storage) GetFile(key string) ([]byte, error)
- func (s *S3Storage) ListFiles(dirPath string) ([]string, error)
- func (s *S3Storage) ListSubDir(rootDir string) ([]string, error)
- func (s *S3Storage) PutFile(key string, content []byte) error
Constants ¶
View Source
const (
// S3StorageURL is the url of the S3 storage.
S3 = "s3"
)
Variables ¶
View Source
var ( // ErrUnknownStorage is the error of unknown storage. ErrUnknownStorage = errors.New("unknown storage") )
Functions ¶
This section is empty.
Types ¶
type ExternalStorage ¶
type ExternalStorage interface { // GetFile returns the file content of the given path. GetFile(filePath string) ([]byte, error) // PutFile puts the file content to the given path. PutFile(filePath string, content []byte) error // ListFiles returns the file names under the given path. ListFiles(dirPath string) ([]string, error) // ListSubDir returns the sub-directory of the given path. ListSubDir(rootDir string) ([]string, error) // DeleteFile deletes the file of the given path. DeleteFile(filePath string) error }
func NewExternalStorage ¶
func NewExternalStorage(storageType string, cfg *utils.StorageConfig) (ExternalStorage, error)
NewExternalStorage creates a new external storage.
func NewS3Storage ¶
func NewS3Storage(cfg *utils.StorageConfig) ExternalStorage
NewS3Storage creates a new S3 client.
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage is aws S3 service.
func (*S3Storage) DeleteFile ¶
DeleteFile deletes the file in the S3.
func (*S3Storage) ListSubDir ¶
ListSubDir lists the sub-directory in the S3.
Click to show internal directories.
Click to hide internal directories.