Skip to content

Commit

Permalink
enhance gogf#3063 (gogf#3115)
Browse files Browse the repository at this point in the history
  • Loading branch information
oldme-git authored Nov 6, 2023
1 parent 50b04c6 commit 007fe0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/genctrl/genctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gf gen ctrl
)

const (
PatternApiDefinition = `type\s+(\w+)Req\s+struct\s+{([\s\S]+?)}`
PatternApiDefinition = `type[\s\(]+(\w+)Req\s+struct\s+{([\s\S]+?)}`
PatternCtrlDefinition = `func\s+\(.+?\)\s+\w+\(.+?\*(\w+)\.(\w+)Req\)\s+\(.+?\*(\w+)\.(\w+)Res,\s+\w+\s+error\)\s+{`
)

Expand Down
24 changes: 14 additions & 10 deletions cmd/gf/internal/cmd/testdata/genctrl/api/article/v1/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ package v1

import "github.com/gogf/gf/v2/frame/g"

type CreateReq struct {
g.Meta `path:"/article/create" method:"post" tags:"ArticleService"`
Title string `v:"required"`
}
type (
CreateReq struct {
g.Meta `path:"/article/create" method:"post" tags:"ArticleService"`
Title string `v:"required"`
}

type CreateRes struct{}
CreateRes struct{}
)

type UpdateReq struct {
g.Meta `path:"/article/update" method:"post" tags:"ArticleService"`
Title string `v:"required"`
}
type (
UpdateReq struct {
g.Meta `path:"/article/update" method:"post" tags:"ArticleService"`
Title string `v:"required"`
}

type UpdateRes struct{}
UpdateRes struct{}
)

0 comments on commit 007fe0e

Please sign in to comment.