✨ guide
This commit is contained in:
@ -7,10 +7,24 @@ import (
|
||||
)
|
||||
|
||||
type Driver interface {
|
||||
Items() []Item
|
||||
Path(path string, account *model.Account) (*model.File, []*model.File, error)
|
||||
Link(path string, account *model.Account) (string,error)
|
||||
Link(path string, account *model.Account) (string, error)
|
||||
Save(account *model.Account, old *model.Account) error
|
||||
Proxy(ctx *fiber.Ctx)
|
||||
// TODO
|
||||
//MakeDir(path string, account *model.Account) error
|
||||
//Move(src string, des string, account *model.Account) error
|
||||
//Delete(path string) error
|
||||
//Upload(file *fs.File, path string, account *model.Account) error
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Name string `json:"name"`
|
||||
Label string `json:"label"`
|
||||
Type string `json:"type"`
|
||||
Required bool `json:"required"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
var driversMap = map[string]Driver{}
|
||||
@ -24,12 +38,12 @@ func GetDriver(name string) (driver Driver, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetDriverNames() []string {
|
||||
names := make([]string, 0)
|
||||
for k, _ := range driversMap {
|
||||
names = append(names, k)
|
||||
func GetDrivers() map[string][]Item {
|
||||
res := make(map[string][]Item, 0)
|
||||
for k, v := range driversMap {
|
||||
res[k] = v.Items()
|
||||
}
|
||||
return names
|
||||
return res
|
||||
}
|
||||
|
||||
type Json map[string]interface{}
|
||||
@ -37,4 +51,4 @@ type Json map[string]interface{}
|
||||
func JsonStr(j Json) string {
|
||||
data, _ := json.Marshal(j)
|
||||
return string(data)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user