Skip to content

Commit

Permalink
pr check 中提示的优化
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbraceUU committed Feb 15, 2022
1 parent a2ddb04 commit 21d83fb
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions plugins/admin/modules/parameter/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,24 @@ func (param Parameters) IsAll() bool {
return param.GetFieldValue(IsAll) == True
}

func (param Parameters) WithURLPath(path string) Parameters {
func (param *Parameters) WithURLPath(path string) Parameters {
param.URLPath = path
return param
return *param
}

func (param *Parameters) isAllTrue() {
param.Fields[IsAll] = []string{True}
}

func (param *Parameters) isAllFalse() {
param.Fields[IsAll] = []string{False}
}

func (param Parameters) WithIsAll(isAll bool) Parameters {
if isAll {
param.Fields[IsAll] = []string{True}
param.isAllTrue()
} else {
param.Fields[IsAll] = []string{False}
param.isAllFalse()
}
return param
}
Expand Down Expand Up @@ -254,16 +262,16 @@ func (param Parameters) Join() string {
return p.Encode()
}

func (param Parameters) SetPage(page string) Parameters {
func (param *Parameters) SetPage(page string) Parameters {
param.Page = page
param.PageInt, _ = strconv.Atoi(page)
return param
return *param
}

func (param Parameters) SetPageSize(pageSize string) Parameters {
func (param *Parameters) SetPageSize(pageSize string) Parameters {
param.PageSize = pageSize
param.PageSizeInt, _ = strconv.Atoi(pageSize)
return param
return *param
}

func (param Parameters) GetRouteParamStr() string {
Expand Down

0 comments on commit 21d83fb

Please sign in to comment.