/
definition.go
35 lines (27 loc) · 1.45 KB
/
definition.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package storage
import (
"context"
"io/fs"
"mime/multipart"
"time"
)
type Buckets interface {
UploadImage(ctx context.Context, file multipart.File, fileName *string) error
UploadFile(ctx context.Context, file multipart.File, fileName *string) error
UploadImageFromLocalPath(ctx context.Context, filePath string, fileName *string, deleteAfterSuccess ...bool) error
UploadFileFromLocalPath(ctx context.Context, filePath string, fileName *string, deleteAfterSuccess ...bool) error
UploadImagePublic(ctx context.Context, file multipart.File, fileName *string) error
UploadFilePublic(ctx context.Context, file multipart.File, fileName *string) error
UploadImageFromLocalPathPublic(ctx context.Context, filePath string, fileName *string, deleteAfterSuccess ...bool) error
UploadFileFromLocalPathPublic(ctx context.Context, filePath string, fileName *string, deleteAfterSuccess ...bool) error
GetSignedURLFile(ctx context.Context, imgPath string) (signedUrl string, err error)
GetFileFS(ctx context.Context, filePath string) (fs.File, error)
SetFileExpiredTime(minutes int) Buckets
SetBucketName(fileName string) Buckets
SetContentType(contentType string) Buckets
RollbackProcess(ctx context.Context, fileName string) error
DeleteFile(ctx context.Context, fileName string) error
CopyFileToAnotherBucket(ctx context.Context, destBucket, fileName string) error
GenerateSignedURL(urlType string, path string, expires ...time.Duration) (string, error)
Close()
}