Skip to content

Commit d0a0b13

Browse files
committedSep 30, 2020
removed bad import
1 parent 1879f55 commit d0a0b13

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed
 

‎example/server.gen.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎example/server.go.plush

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package <%= def.PackageName %>
44

55
import (
66
"context"
7-
"log"
87
"net/http"
98

109
"github.com/pacedotdev/oto/otohttp"
@@ -16,7 +15,7 @@ import (
1615
<%= for (service) in def.Services { %>
1716
<%= format_comment_text(service.Comment) %>type <%= service.Name %> interface {
1817
<%= for (method) in service.Methods { %>
19-
<%= method.Name %>(context.Context, <%= method.InputObject.TypeName %>) (*<%= method.OutputObject.TypeName %>, error)<% } %>
18+
<%= format_comment_text(method.Comment) %><%= method.Name %>(context.Context, <%= method.InputObject.TypeName %>) (*<%= method.OutputObject.TypeName %>, error)<% } %>
2019
}
2120
<% } %>
2221

@@ -43,8 +42,7 @@ func (s *<%= camelize_down(service.Name) %>Server) handle<%= method.Name %>(w ht
4342
}
4443
response, err := s.<%= camelize_down(service.Name) %>.<%= method.Name %>(r.Context(), request)
4544
if err != nil {
46-
log.Println("TODO: oto service error:", err)
47-
http.Error(w, err.Error(), http.StatusInternalServerError)
45+
s.server.OnErr(w, r, err)
4846
return
4947
}
5048
if err := otohttp.Encode(w, r, http.StatusOK, response); err != nil {
@@ -57,7 +55,7 @@ func (s *<%= camelize_down(service.Name) %>Server) handle<%= method.Name %>(w ht
5755

5856
<%= for (object) in def.Objects { %>
5957
<%= format_comment_text(object.Comment) %>type <%= object.Name %> struct {
60-
<%= for (field) in object.Fields { %><%= format_comment_text(field.Comment) %><%= field.Name %> <%= if (field.Type.Multiple == true) { %>[]<% } %><%= field.Type.TypeName %> `json:"<%= camelize_down(field.Name) %><%= if (field.OmitEmpty) { %>,omitempty<% } %>"`
58+
<%= for (field) in object.Fields { %><%= format_comment_text(field.Comment) %><%= field.Name %> <%= if (field.Type.Multiple == true) { %>[]<% } %><%= field.Type.TypeName %> `json:"<%= field.NameLowerCamel %><%= if (field.OmitEmpty) { %>,omitempty<% } %>"`
6159
<% } %>
6260
}
6361
<% } %>

‎otohttp/templates/server.go.plush

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package <%= def.PackageName %>
44

55
import (
66
"context"
7-
"log"
87
"net/http"
98

109
"github.com/pacedotdev/oto/otohttp"

0 commit comments

Comments
 (0)
Please sign in to comment.