Skip to content

Commit 9db0aa9

Browse files
lvan100lianghuan
authored andcommitted
111
1 parent a3045d5 commit 9db0aa9

File tree

5 files changed

+60
-77
lines changed

5 files changed

+60
-77
lines changed

gen/generator/golang/proto/http_handler.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/generator/golang/type.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const {{$c.Name}} {{$c.Type}} = {{$c.Value}}
120120
{{range $s := .Structs}}
121121
{{$s.Comment}}
122122
type {{$s.Name}} struct {
123+
ObjectBase
123124
{{- range $f := $s.Fields}}
124125
{{- if $f.Comment}}
125126
{{$f.Comment}}
@@ -133,20 +134,18 @@ const {{$c.Name}} {{$c.Type}} = {{$c.Value}}
133134
return &{{$s.Name}}{}
134135
}
135136
136-
// Binding extracts non-body values (header, path, query) from *http.Request
137-
func (x *{{$s.Name}}) Binding(r *http.Request) error {
138-
{{- if $s.BindingCount}}
137+
{{- if $s.BindingCount}}
138+
// Binding extracts non-body values (header, path, query) from *http.Request
139+
func (x *{{$s.Name}}) Binding(r *http.Request) error {
139140
return Binding(r, []BindingField {
140141
{{- range $f := $s.Fields}}
141142
{{- if $f.Binding}}
142143
{"{{$s.Name}}.{{$f.Name}}", "{{$f.Binding.From}}", "{{$f.Binding.Name}}", &x.{{$f.Name}}},
143144
{{- end}}
144145
{{- end}}
145146
})
146-
{{- else}}
147-
return nil
148-
{{- end}}
149-
}
147+
}
148+
{{- end}}
150149
151150
// Validate checks field values using generated validation expressions
152151
func (x *{{$s.Name}}) Validate() error {

gen/testdata/manager/go/proto/http_handler.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/testdata/manager/go/proto/manager.go

Lines changed: 15 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/testdata/manager/go/proto/stream.go

Lines changed: 3 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)