-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.go
55 lines (49 loc) · 1.38 KB
/
storage.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package filesystem
import (
"context"
"time"
)
//go:generate mockery --name=IStorage
type IStorage interface {
Driver
Disk(disk string) IStorage
}
//go:generate mockery --name=Driver
type Driver interface {
AllDirectories(path string) ([]string, error)
AllFiles(path string) ([]string, error)
Copy(oldFile, newFile string) error
Delete(file ...string) error
DeleteDirectory(directory string) error
Directories(path string) ([]string, error)
// Download(path string)
Exists(file string) bool
Files(path string) ([]string, error)
Get(file string) (string, error)
MakeDirectory(directory string) error
Missing(file string) bool
Move(oldFile, newFile string) error
Path(file string) string
Put(file, content string) error
PutFile(path string, source File) (string, error)
PutFileAs(path string, source File, name string) (string, error)
Size(file string) (int64, error)
TemporaryUrl(file string, time time.Time) (string, error)
WithContext(ctx context.Context) IStorage
Url(file string) string
}
//go:generate mockery --name=File
type File interface {
Disk(disk string) File
File() string
Store(path string) (string, error)
StoreAs(path string, name string) (string, error)
GetClientOriginalName() string
GetClientOriginalExtension() string
HashName(path ...string) string
Extension() (string, error)
}
type Option func(options *Options)
type Options struct {
Name string
}