Documentation ¶
Index ¶
- Constants
- type S3Config
- type S3Storage
- func (s *S3Storage) DeleteFile(ctx context.Context, objectKey string) error
- func (s *S3Storage) DownloadFile(ctx context.Context, objectKey string) (io.ReadCloser, error)
- func (s *S3Storage) Exist(ctx context.Context, objectKey string) (bool, error)
- func (s *S3Storage) GetURL(ctx context.Context, objectKey string) (string, error)
- func (s *S3Storage) UploadFile(ctx context.Context, objectKey string, reader io.Reader) (string, error)
- type Storage
Constants ¶
View Source
const ErrCodeNotFound = "NotFound"
View Source
const TypeS3 = "s3"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type S3Config ¶
type S3Config struct { AccessKeyID string `json:"access_key_id" yaml:"access_key_id"` SecretAccessKey string `json:"secret_access_key" yaml:"secret_access_key"` Bucket string `json:"bucket" yaml:"bucket"` Region string `json:"region" yaml:"region"` Directory string `json:"directory" yaml:"directory"` PresignURLExpiration time.Duration `json:"presign_url_expiration" yaml:"presign_url_expiration"` MaxKeys int64 `json:"max_keys" yaml:"max_keys"` // Set nil to use default value Endpoint *string `json:"endpoint" yaml:"endpoint"` S3ForcePathStyle *bool `json:"s3_force_path_style" yaml:"s3_force_path_style"` DisableSSL *bool `json:"disable_ssl" yaml:"disable_ssl"` }
S3Config defines config for s3 storage
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage defines methods to access S3
func (*S3Storage) DeleteFile ¶
DeleteFile deletes file from S3
func (*S3Storage) DownloadFile ¶
DownloadFile downloads file from S3 returns the body
type Storage ¶
type Storage interface { UploadFile(ctx context.Context, objectKey string, reader io.Reader) (string, error) DownloadFile(ctx context.Context, objectKey string) (io.ReadCloser, error) DeleteFile(ctx context.Context, objectKey string) error GetURL(ctx context.Context, objectKey string) (string, error) Exist(ctx context.Context, objectKey string) (bool, error) }
Storage defines interface for store data file
Click to show internal directories.
Click to hide internal directories.