chore: fix typo

refactor/fs
Noah Hsu 2022-07-12 18:41:16 +08:00
parent 2bff656f00
commit a16da3b45e
7 changed files with 17 additions and 6 deletions

View File

@ -20,7 +20,7 @@ type Driver struct {
Addition
}
func (d Driver) Config() driver.Config {
func (d *Driver) Config() driver.Config {
return config
}
@ -175,7 +175,7 @@ func (d *Driver) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr
return nil
}
func (d Driver) Other(ctx context.Context, data interface{}) (interface{}, error) {
func (d *Driver) Other(ctx context.Context, data interface{}) (interface{}, error) {
return nil, errs.NotSupport
}

View File

@ -27,8 +27,8 @@ type Proxy struct {
DownProxyUrl string `json:"down_proxy_url"`
}
func (a Storage) GetStorage() Storage {
return a
func (a *Storage) GetStorage() Storage {
return *a
}
func (a *Storage) SetStatus(status string) {

View File

@ -54,7 +54,7 @@ func registerDriverItems(config driver.Config, addition driver.Additional) {
func getMainItems(config driver.Config) []driver.Item {
items := []driver.Item{{
Name: "virtual_path",
Name: "mount_path",
Type: conf.TypeString,
Required: true,
Help: "",
@ -62,6 +62,9 @@ func getMainItems(config driver.Config) []driver.Item {
Name: "index",
Type: conf.TypeNumber,
Help: "use to sort",
}, {
Name: "remark",
Type: conf.TypeText,
}, {
Name: "down_proxy_url",
Type: conf.TypeText,

View File

@ -5,11 +5,16 @@ type PageReq struct {
PageSize int `json:"page_size" form:"page_size"`
}
const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1
func (p *PageReq) Validate() {
if p.PageIndex < 1 {
p.PageIndex = 1
}
if p.PageSize < 1 {
p.PageSize = 50
p.PageSize = MaxInt
}
}

View File

@ -20,6 +20,7 @@ func ListMetas(c *gin.Context) {
common.ErrorResp(c, err, 400)
return
}
req.Validate()
log.Debugf("%+v", req)
metas, total, err := db.GetMetas(req.PageIndex, req.PageSize)
if err != nil {

View File

@ -17,6 +17,7 @@ func ListStorages(c *gin.Context) {
common.ErrorResp(c, err, 400)
return
}
req.Validate()
log.Debugf("%+v", req)
storages, total, err := db.GetStorages(req.PageIndex, req.PageSize)
if err != nil {

View File

@ -16,6 +16,7 @@ func ListUsers(c *gin.Context) {
common.ErrorResp(c, err, 400)
return
}
req.Validate()
log.Debugf("%+v", req)
users, total, err := db.GetUsers(req.PageIndex, req.PageSize)
if err != nil {