Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
david-littlefarmer committed Apr 29, 2024
1 parent 5b9762f commit b63daec
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
13 changes: 12 additions & 1 deletion _examples/golang-basics/example.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion _examples/golang-imports/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions _examples/golang-imports/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ func startServer() error {
return http.ListenAndServe(":4242", r)
}

type ExampleRPC struct {
}
type ExampleRPC struct{}

func (s *ExampleRPC) Ping(ctx context.Context) error {
return nil
Expand All @@ -44,9 +43,9 @@ func (s *ExampleRPC) Status(ctx context.Context) (bool, error) {
return true, nil
}

func (s *ExampleRPC) GetUsers(ctx context.Context) ([]*User, *Location, error) {
func (s *ExampleRPC) GetUsers(ctx context.Context) ([]*User, Location, error) {
loc := Location_TORONTO
return []*User{
{Username: "pk", Age: 99},
}, &loc, nil
}, loc, nil
}
12 changes: 6 additions & 6 deletions types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ var WebRPCServices = map[string][]string{
{{- end}}
}

var WebRPCServicesMap = map[string]map[string]struct{}{
type Route struct{}

var WebRPCServicesMap = map[string]Route{
{{- range $_, $service := $services}}
"{{$service.Name}}": {
{{- range $_, $method := $service.Methods}}
"{{$method.Name}}": struct{}{},
{{- end}}
},
{{- range $_, $method := $service.Methods}}
"/rpc/{{$service.Name}}/{{$method.Name}}": {},
{{- end}}
{{- end}}
}

Expand Down

0 comments on commit b63daec

Please sign in to comment.