From ec4e17f63783353cc6432fabc3f6327c78e7430b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sedl=C3=A1=C4=8Dek?= Date: Mon, 29 Apr 2024 13:43:38 +0200 Subject: [PATCH] updated examples --- _examples/golang-basics/example.gen.go | 13 ++++++++++++- _examples/golang-imports/api.gen.go | 10 +++++++++- _examples/golang-imports/main.go | 7 +++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/_examples/golang-basics/example.gen.go b/_examples/golang-basics/example.gen.go index 632dd51..ed86676 100644 --- a/_examples/golang-basics/example.gen.go +++ b/_examples/golang-basics/example.gen.go @@ -1,6 +1,6 @@ // example v0.0.1 3a3a4087149f1118f0b9494fa254afab46564a1b // -- -// Code generated by webrpc-gen@v0.18.3 with ../../../gen-golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.18.1 with ../../../gen-golang generator. DO NOT EDIT. // // webrpc-gen -schema=example.ridl -target=../../../gen-golang -pkg=main -server -client -legacyErrors -fixEmptyArrays -out=./example.gen.go package main @@ -171,6 +171,17 @@ var WebRPCServices = map[string][]string{ }, } +var WebRPCServicesMap = map[string]map[string]struct{}{ + "ExampleService": { + "Ping": struct{}{}, + "Status": struct{}{}, + "Version": struct{}{}, + "GetUser": struct{}{}, + "FindUser": struct{}{}, + "LogEvent": struct{}{}, + }, +} + // // Server types // diff --git a/_examples/golang-imports/api.gen.go b/_examples/golang-imports/api.gen.go index cd3a6a8..e65357d 100644 --- a/_examples/golang-imports/api.gen.go +++ b/_examples/golang-imports/api.gen.go @@ -1,6 +1,6 @@ // example-api-service v1.0.0 eb9a5d4082a36a8cb84eaa4b3e1091fc4f1f6f3d // -- -// Code generated by webrpc-gen@v0.18.3 with ../../../gen-golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.18.1 with ../../../gen-golang generator. DO NOT EDIT. // // webrpc-gen -schema=./proto/api.ridl -target=../../../gen-golang -out=./api.gen.go -pkg=main -server -client -legacyErrors=true -fmt=false package main @@ -92,6 +92,14 @@ var WebRPCServices = map[string][]string{ }, } +var WebRPCServicesMap = map[string]map[string]struct{}{ + "ExampleAPI": { + "Ping": struct{}{}, + "Status": struct{}{}, + "GetUsers": struct{}{}, + }, +} + // // Server types // diff --git a/_examples/golang-imports/main.go b/_examples/golang-imports/main.go index 5a12100..44fec3c 100644 --- a/_examples/golang-imports/main.go +++ b/_examples/golang-imports/main.go @@ -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 @@ -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 }