From 995ba89d78c439b447c875ad3c7e30fafa97ac5e Mon Sep 17 00:00:00 2001 From: Vojtech Vitek Date: Fri, 26 Apr 2024 15:16:40 +0200 Subject: [PATCH 1/2] Basic example: Generate example client --- _examples/golang-basics/client/example.gen.go | 654 ++++++++++++++++++ 1 file changed, 654 insertions(+) create mode 100644 _examples/golang-basics/client/example.gen.go diff --git a/_examples/golang-basics/client/example.gen.go b/_examples/golang-basics/client/example.gen.go new file mode 100644 index 0000000..ae2083c --- /dev/null +++ b/_examples/golang-basics/client/example.gen.go @@ -0,0 +1,654 @@ +// example v0.0.1 3a3a4087149f1118f0b9494fa254afab46564a1b +// -- +// Code generated by webrpc-gen@v0.18.4 with ../../../gen-golang generator. DO NOT EDIT. +// +// webrpc-gen -schema=example.ridl -target=../../../gen-golang -pkg=example -client -legacyErrors -fixEmptyArrays -out=./client/example.gen.go +package example + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "time" + + "github.com/google/uuid" +) + +// WebRPC description and code-gen version +func WebRPCVersion() string { + return "v1" +} + +// Schema version of your RIDL schema +func WebRPCSchemaVersion() string { + return "v0.0.1" +} + +// Schema hash generated from your RIDL schema +func WebRPCSchemaHash() string { + return "3a3a4087149f1118f0b9494fa254afab46564a1b" +} + +// +// Common types +// + +type Kind uint32 + +const ( + // user can only see number of transactions + Kind_USER Kind = 0 + // admin permissions + // can manage transactions + // revert transactions + // see analytics dashboard + Kind_ADMIN Kind = 1 +) + +var Kind_name = map[uint32]string{ + 0: "USER", + 1: "ADMIN", +} + +var Kind_value = map[string]uint32{ + "USER": 0, + "ADMIN": 1, +} + +func (x Kind) String() string { + return Kind_name[uint32(x)] +} + +func (x Kind) MarshalText() ([]byte, error) { + return []byte(Kind_name[uint32(x)]), nil +} + +func (x *Kind) UnmarshalText(b []byte) error { + *x = Kind(Kind_value[string(b)]) + return nil +} + +func (x *Kind) Is(values ...Kind) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +type Intent string + +const ( + Intent_openSession Intent = "openSession" + Intent_closeSession Intent = "closeSession" + Intent_validateSession Intent = "validateSession" +) + +func (x Intent) MarshalText() ([]byte, error) { + return []byte(x), nil +} + +func (x *Intent) UnmarshalText(b []byte) error { + *x = Intent(string(b)) + return nil +} + +func (x *Intent) Is(values ...Intent) bool { + if x == nil { + return false + } + for _, v := range values { + if *x == v { + return true + } + } + return false +} + +// Defines users within out wallet app +type User struct { + ID uint64 `json:"id" db:"id"` + Uuid uuid.UUID `json:"uuid" db:"id"` + // unique identifier of the user + // must be unique ! + Username string `json:"USERNAME" db:"username"` + Role string `json:"role" db:"-"` + Nicknames []Nickname `json:"nicknames" db:"-"` + CreatedAt time.Time `json:"createdAt" db:"created_at"` + UpdatedAt *time.Time `json:"updatedAt" db:"updated_at"` + Kind Kind `json:"kind"` + Intent Intent `json:"intent"` +} + +type Nickname struct { + ID uint64 `json:"ID" db:"id"` + Nickname string `json:"nickname" db:"nickname"` + CreatedAt time.Time `json:"createdAt" db:"created_at"` + UpdatedAt *time.Time `json:"updatedAt" db:"updated_at"` +} + +type SearchFilter struct { + Q string `json:"q"` +} + +type Version struct { + WebrpcVersion string `json:"webrpcVersion"` + SchemaVersion string `json:"schemaVersion"` + SchemaHash string `json:"schemaHash"` +} + +type ComplexType struct { + Meta map[string]interface{} `json:"meta"` + MetaNestedExample map[string]map[string]uint32 `json:"metaNestedExample"` + NamesList []string `json:"namesList"` + NumsList []int64 `json:"numsList"` + DoubleArray [][]string `json:"doubleArray"` + ListOfMaps []map[string]uint32 `json:"listOfMaps"` + ListOfUsers []*User `json:"listOfUsers"` + MapOfUsers map[string]*User `json:"mapOfUsers"` + User *User `json:"user"` +} + +var WebRPCServices = map[string][]string{ + "ExampleService": { + "Ping", + "Status", + "Version", + "GetUser", + "FindUser", + "LogEvent", + }, +} + +// +// Server types +// + +type ExampleService interface { + Ping(ctx context.Context) error + // Status endpoint + // + // gives you current status of running application + Status(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + GetUser(ctx context.Context, header map[string]string, userID uint64) (*User, error) + FindUser(ctx context.Context, s *SearchFilter) (string, *User, error) + LogEvent(ctx context.Context, event string) error +} + +// +// Client types +// + +type ExampleServiceClient interface { + Ping(ctx context.Context) error + // Status endpoint + // + // gives you current status of running application + Status(ctx context.Context) (bool, error) + Version(ctx context.Context) (*Version, error) + GetUser(ctx context.Context, header map[string]string, userID uint64) (*User, error) + FindUser(ctx context.Context, s *SearchFilter) (string, *User, error) + LogEvent(ctx context.Context, event string) error +} + +// +// Client +// + +const ExampleServicePathPrefix = "/rpc/ExampleService/" + +type exampleServiceClient struct { + client HTTPClient + urls [6]string +} + +func NewExampleServiceClient(addr string, client HTTPClient) ExampleServiceClient { + prefix := urlBase(addr) + ExampleServicePathPrefix + urls := [6]string{ + prefix + "Ping", + prefix + "Status", + prefix + "Version", + prefix + "GetUser", + prefix + "FindUser", + prefix + "LogEvent", + } + return &exampleServiceClient{ + client: client, + urls: urls, + } +} + +func (c *exampleServiceClient) Ping(ctx context.Context) error { + + resp, err := doHTTPRequest(ctx, c.client, c.urls[0], nil, nil) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) + } + } + + return err +} + +func (c *exampleServiceClient) Status(ctx context.Context) (bool, error) { + out := struct { + Ret0 bool `json:"status"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[1], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) + } + } + + return out.Ret0, err +} + +func (c *exampleServiceClient) Version(ctx context.Context) (*Version, error) { + out := struct { + Ret0 *Version `json:"version"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[2], nil, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) + } + } + + return out.Ret0, err +} + +func (c *exampleServiceClient) GetUser(ctx context.Context, header map[string]string, userID uint64) (*User, error) { + in := struct { + Arg0 map[string]string `json:"header"` + Arg1 uint64 `json:"userID"` + }{header, userID} + out := struct { + Ret0 *User `json:"user"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[3], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) + } + } + + return out.Ret0, err +} + +func (c *exampleServiceClient) FindUser(ctx context.Context, s *SearchFilter) (string, *User, error) { + in := struct { + Arg0 *SearchFilter `json:"s"` + }{s} + out := struct { + Ret0 string `json:"name"` + Ret1 *User `json:"user"` + }{} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[4], in, &out) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) + } + } + + return out.Ret0, out.Ret1, err +} + +func (c *exampleServiceClient) LogEvent(ctx context.Context, event string) error { + in := struct { + Arg0 string `json:"event"` + }{event} + + resp, err := doHTTPRequest(ctx, c.client, c.urls[5], in, nil) + if resp != nil { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to close response body: %w", cerr)) + } + } + + return err +} + +// HTTPClient is the interface used by generated clients to send HTTP requests. +// It is fulfilled by *(net/http).Client, which is sufficient for most users. +// Users can provide their own implementation for special retry policies. +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +// urlBase helps ensure that addr specifies a scheme. If it is unparsable +// as a URL, it returns addr unchanged. +func urlBase(addr string) string { + // If the addr specifies a scheme, use it. If not, default to + // http. If url.Parse fails on it, return it unchanged. + url, err := url.Parse(addr) + if err != nil { + return addr + } + if url.Scheme == "" { + url.Scheme = "http" + } + return url.String() +} + +// newRequest makes an http.Request from a client, adding common headers. +func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { + req, err := http.NewRequestWithContext(ctx, "POST", url, reqBody) + if err != nil { + return nil, err + } + req.Header.Set("Accept", contentType) + req.Header.Set("Content-Type", contentType) + if headers, ok := HTTPRequestHeaders(ctx); ok { + for k := range headers { + for _, v := range headers[k] { + req.Header.Add(k, v) + } + } + } + return req, nil +} + +// doHTTPRequest is common code to make a request to the remote service. +func doHTTPRequest(ctx context.Context, client HTTPClient, url string, in, out interface{}) (*http.Response, error) { + reqBody, err := json.Marshal(in) + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCause(fmt.Errorf("failed to marshal JSON body: %w", err)) + } + if err = ctx.Err(); err != nil { + return nil, ErrWebrpcRequestFailed.WithCause(fmt.Errorf("aborted because context was done: %w", err)) + } + + req, err := newRequest(ctx, url, bytes.NewBuffer(reqBody), "application/json") + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCause(fmt.Errorf("could not build request: %w", err)) + } + + resp, err := client.Do(req) + if err != nil { + return nil, ErrWebrpcRequestFailed.WithCause(err) + } + + if resp.StatusCode != 200 { + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCause(fmt.Errorf("failed to read server error response body: %w", err)) + } + + var rpcErr WebRPCError + if err := json.Unmarshal(respBody, &rpcErr); err != nil { + return nil, ErrWebrpcBadResponse.WithCause(fmt.Errorf("failed to unmarshal server error: %w", err)) + } + if rpcErr.Cause != "" { + rpcErr.cause = errors.New(rpcErr.Cause) + } + return nil, rpcErr + } + + if out != nil { + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCause(fmt.Errorf("failed to read response body: %w", err)) + } + + err = json.Unmarshal(respBody, &out) + if err != nil { + return nil, ErrWebrpcBadResponse.WithCause(fmt.Errorf("failed to unmarshal JSON response body: %w", err)) + } + } + + return resp, nil +} + +func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error) { + if _, ok := h["Accept"]; ok { + return nil, errors.New("provided header cannot set Accept") + } + if _, ok := h["Content-Type"]; ok { + return nil, errors.New("provided header cannot set Content-Type") + } + + copied := make(http.Header, len(h)) + for k, vv := range h { + if vv == nil { + copied[k] = nil + continue + } + copied[k] = make([]string, len(vv)) + copy(copied[k], vv) + } + + return context.WithValue(ctx, HTTPClientRequestHeadersCtxKey, copied), nil +} + +func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { + h, ok := ctx.Value(HTTPClientRequestHeadersCtxKey).(http.Header) + return h, ok +} + +// +// Helpers +// + +type contextKey struct { + name string +} + +func (k *contextKey) String() string { + return "webrpc context value " + k.name +} + +var ( + HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} + HTTPRequestCtxKey = &contextKey{"HTTPRequest"} + + ServiceNameCtxKey = &contextKey{"ServiceName"} + + MethodNameCtxKey = &contextKey{"MethodName"} +) + +func ServiceNameFromContext(ctx context.Context) string { + service, _ := ctx.Value(ServiceNameCtxKey).(string) + return service +} + +func MethodNameFromContext(ctx context.Context) string { + method, _ := ctx.Value(MethodNameCtxKey).(string) + return method +} + +func RequestFromContext(ctx context.Context) *http.Request { + r, _ := ctx.Value(HTTPRequestCtxKey).(*http.Request) + return r +} + +// +// Errors +// + +type WebRPCError struct { + Name string `json:"error"` + Code int `json:"code"` + Message string `json:"msg"` + Cause string `json:"cause,omitempty"` + HTTPStatus int `json:"status"` + cause error +} + +var _ error = WebRPCError{} + +func (e WebRPCError) Error() string { + if e.cause != nil { + return fmt.Sprintf("%s %d: %s: %v", e.Name, e.Code, e.Message, e.cause) + } + return fmt.Sprintf("%s %d: %s", e.Name, e.Code, e.Message) +} + +func (e WebRPCError) Is(target error) bool { + if target == nil { + return false + } + if rpcErr, ok := target.(WebRPCError); ok { + return rpcErr.Code == e.Code + } + if legacyErr, ok := target.(legacyError); ok { + return legacyErr.Code == e.Code + } + return errors.Is(e.cause, target) +} + +func (e WebRPCError) Unwrap() error { + return e.cause +} + +func (e WebRPCError) WithCause(cause error) WebRPCError { + err := e + err.cause = cause + err.Cause = cause.Error() + return err +} + +func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError { + cause := fmt.Errorf(format, args...) + err := e + err.cause = cause + err.Cause = cause.Error() + return err +} + +// Deprecated: Use .WithCause() method on WebRPCError. +func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError { + return rpcErr.WithCause(cause) +} + +// Webrpc errors +var ( + ErrWebrpcEndpoint = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400} + ErrWebrpcRequestFailed = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 400} + ErrWebrpcBadRoute = WebRPCError{Code: -2, Name: "WebrpcBadRoute", Message: "bad route", HTTPStatus: 404} + ErrWebrpcBadMethod = WebRPCError{Code: -3, Name: "WebrpcBadMethod", Message: "bad method", HTTPStatus: 405} + ErrWebrpcBadRequest = WebRPCError{Code: -4, Name: "WebrpcBadRequest", Message: "bad request", HTTPStatus: 400} + ErrWebrpcBadResponse = WebRPCError{Code: -5, Name: "WebrpcBadResponse", Message: "bad response", HTTPStatus: 500} + ErrWebrpcServerPanic = WebRPCError{Code: -6, Name: "WebrpcServerPanic", Message: "server panic", HTTPStatus: 500} + ErrWebrpcInternalError = WebRPCError{Code: -7, Name: "WebrpcInternalError", Message: "internal error", HTTPStatus: 500} + ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400} + ErrWebrpcStreamLost = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400} + ErrWebrpcStreamFinished = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200} +) + +// Schema errors +var ( + ErrMissingArgument = WebRPCError{Code: 500100, Name: "MissingArgument", Message: "missing argument", HTTPStatus: 400} + ErrInvalidUsername = WebRPCError{Code: 500101, Name: "InvalidUsername", Message: "invalid username", HTTPStatus: 400} + ErrMemoryFull = WebRPCError{Code: 400100, Name: "MemoryFull", Message: "system memory is full", HTTPStatus: 400} + ErrUnauthorized = WebRPCError{Code: 400200, Name: "Unauthorized", Message: "unauthorized", HTTPStatus: 401} + ErrUserNotFound = WebRPCError{Code: 400300, Name: "UserNotFound", Message: "user not found", HTTPStatus: 400} +) + +// +// Legacy errors +// + +// Deprecated: Use fmt.Errorf() or WebRPCError. +func Errorf(err legacyError, format string, args ...interface{}) WebRPCError { + return err.WebRPCError.WithCause(fmt.Errorf(format, args...)) +} + +// Deprecated: Use .WithCause() method on WebRPCError. +func WrapError(err legacyError, cause error, format string, args ...interface{}) WebRPCError { + return err.WebRPCError.WithCause(fmt.Errorf("%v: %w", fmt.Errorf(format, args...), cause)) +} + +// Deprecated: Use fmt.Errorf() or WebRPCError. +func Failf(format string, args ...interface{}) WebRPCError { + return Errorf(ErrFail, format, args...) +} + +// Deprecated: Use .WithCause() method on WebRPCError. +func WrapFailf(cause error, format string, args ...interface{}) WebRPCError { + return WrapError(ErrFail, cause, format, args...) +} + +// Deprecated: Use fmt.Errorf() or WebRPCError. +func ErrorNotFound(format string, args ...interface{}) WebRPCError { + return Errorf(ErrNotFound, format, args...) +} + +// Deprecated: Use fmt.Errorf() or WebRPCError. +func ErrorInvalidArgument(argument string, validationMsg string) WebRPCError { + return Errorf(ErrInvalidArgument, argument+" "+validationMsg) +} + +// Deprecated: Use fmt.Errorf() or WebRPCError. +func ErrorRequiredArgument(argument string) WebRPCError { + return ErrorInvalidArgument(argument, "is required") +} + +// Deprecated: Use fmt.Errorf() or WebRPCError. +func ErrorInternal(format string, args ...interface{}) WebRPCError { + return Errorf(ErrInternal, format, args...) +} + +type legacyError struct{ WebRPCError } + +// Legacy errors (webrpc v0.10.0 and earlier). Will be removed. +var ( + // Deprecated. Define errors in RIDL schema. + ErrCanceled = legacyError{WebRPCError{Code: -10000, Name: "ErrCanceled", Message: "canceled", HTTPStatus: 408 /* RequestTimeout */}} + // Deprecated. Define errors in RIDL schema. + ErrUnknown = legacyError{WebRPCError{Code: -10001, Name: "ErrUnknown", Message: "unknown", HTTPStatus: 400 /* Bad Request */}} + // Deprecated. Define errors in RIDL schema. + ErrFail = legacyError{WebRPCError{Code: -10002, Name: "ErrFail", Message: "fail", HTTPStatus: 422 /* Unprocessable Entity */}} + // Deprecated. Define errors in RIDL schema. + ErrInvalidArgument = legacyError{WebRPCError{Code: -10003, Name: "ErrInvalidArgument", Message: "invalid argument", HTTPStatus: 400 /* BadRequest */}} + // Deprecated. Define errors in RIDL schema. + ErrDeadlineExceeded = legacyError{WebRPCError{Code: -10004, Name: "ErrDeadlineExceeded", Message: "deadline exceeded", HTTPStatus: 408 /* RequestTimeout */}} + // Deprecated. Define errors in RIDL schema. + ErrNotFound = legacyError{WebRPCError{Code: -10005, Name: "ErrNotFound", Message: "not found", HTTPStatus: 404 /* Not Found */}} + // Deprecated. Define errors in RIDL schema. + ErrBadRoute = legacyError{WebRPCError{Code: -10006, Name: "ErrBadRoute", Message: "bad route", HTTPStatus: 404 /* Not Found */}} + // Deprecated. Define errors in RIDL schema. + ErrAlreadyExists = legacyError{WebRPCError{Code: -10007, Name: "ErrAlreadyExists", Message: "already exists", HTTPStatus: 409 /* Conflict */}} + // Deprecated. Define errors in RIDL schema. + ErrPermissionDenied = legacyError{WebRPCError{Code: -10008, Name: "ErrPermissionDenied", Message: "permission denied", HTTPStatus: 403 /* Forbidden */}} + // Deprecated. Define errors in RIDL schema. + ErrUnauthenticated = legacyError{WebRPCError{Code: -10009, Name: "ErrUnauthenticated", Message: "unauthenticated", HTTPStatus: 401 /* Unauthorized */}} + // Deprecated. Define errors in RIDL schema. + ErrResourceExhausted = legacyError{WebRPCError{Code: -10010, Name: "ErrResourceExhausted", Message: "resource exhausted", HTTPStatus: 403 /* Forbidden */}} + // Deprecated. Define errors in RIDL schema. + ErrFailedPrecondition = legacyError{WebRPCError{Code: -10011, Name: "ErrFailedPrecondition", Message: "failed precondition", HTTPStatus: 412 /* Precondition Failed */}} + // Deprecated. Define errors in RIDL schema. + ErrAborted = legacyError{WebRPCError{Code: -10012, Name: "ErrAborted", Message: "aborted", HTTPStatus: 409 /* Conflict */}} + // Deprecated. Define errors in RIDL schema. + ErrOutOfRange = legacyError{WebRPCError{Code: -10013, Name: "ErrOutOfRange", Message: "out of range", HTTPStatus: 400 /* Bad Request */}} + // Deprecated. Define errors in RIDL schema. + ErrUnimplemented = legacyError{WebRPCError{Code: -10014, Name: "ErrUnimplemented", Message: "unimplemented", HTTPStatus: 501 /* Not Implemented */}} + // Deprecated. Define errors in RIDL schema. + ErrInternal = legacyError{WebRPCError{Code: -10015, Name: "ErrInternal", Message: "internal", HTTPStatus: 500 /* Internal Server Error */}} + // Deprecated. Define errors in RIDL schema. + ErrUnavailable = legacyError{WebRPCError{Code: -10016, Name: "ErrUnavailable", Message: "unavailable", HTTPStatus: 503 /* Service Unavailable */}} + // Deprecated. Define errors in RIDL schema. + ErrDataLoss = legacyError{WebRPCError{Code: -10017, Name: "ErrDataLoss", Message: "data loss", HTTPStatus: 500 /* Internal Server Error */}} + // Deprecated. Define errors in RIDL schema. + ErrNone = legacyError{WebRPCError{Code: -10018, Name: "ErrNone", Message: "", HTTPStatus: 200 /* OK */}} +) From 7f2202502fbd709829540b883b2020c2cd39fb65 Mon Sep 17 00:00:00 2001 From: Vojtech Vitek Date: Fri, 26 Apr 2024 15:35:05 +0200 Subject: [PATCH 2/2] Regenerate using latest webrpc --- _examples/golang-basics/client/example.gen.go | 2 +- _examples/golang-basics/example.gen.go | 2 +- _examples/golang-basics/main.go | 1 + _examples/golang-imports/api.gen.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/_examples/golang-basics/client/example.gen.go b/_examples/golang-basics/client/example.gen.go index ae2083c..bb7ae1b 100644 --- a/_examples/golang-basics/client/example.gen.go +++ b/_examples/golang-basics/client/example.gen.go @@ -1,6 +1,6 @@ // example v0.0.1 3a3a4087149f1118f0b9494fa254afab46564a1b // -- -// Code generated by webrpc-gen@v0.18.4 with ../../../gen-golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.18.6 with ../../../gen-golang generator. DO NOT EDIT. // // webrpc-gen -schema=example.ridl -target=../../../gen-golang -pkg=example -client -legacyErrors -fixEmptyArrays -out=./client/example.gen.go package example diff --git a/_examples/golang-basics/example.gen.go b/_examples/golang-basics/example.gen.go index 632dd51..f64adf4 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.6 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 diff --git a/_examples/golang-basics/main.go b/_examples/golang-basics/main.go index 61b5a50..5ff5a56 100644 --- a/_examples/golang-basics/main.go +++ b/_examples/golang-basics/main.go @@ -1,4 +1,5 @@ //go:generate webrpc-gen -schema=example.ridl -target=../../../gen-golang -pkg=main -server -client -legacyErrors -fixEmptyArrays -out=./example.gen.go +//go:generate webrpc-gen -schema=example.ridl -target=../../../gen-golang -pkg=example -client -legacyErrors -fixEmptyArrays -out=./client/example.gen.go package main import ( diff --git a/_examples/golang-imports/api.gen.go b/_examples/golang-imports/api.gen.go index cd3a6a8..a990460 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.6 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