chore: update examples

This commit is contained in:
Stefan Martinov 2025-01-17 23:09:10 +01:00
parent 1e1c201785
commit d5709b5a4f
2 changed files with 13 additions and 4 deletions

View File

@ -27,7 +27,6 @@ build.debug:
go build -gcflags "all=-N -l" -o bin/gotsrpc cmd/gotsrpc/gotsrpc.go
## === Tools ===
example: example.basic example.errors example.monitor example.nullable example.union example.time
EXAMPLES=basic errors monitor nullable union time
define examples

View File

@ -24,20 +24,30 @@ type HTTPServiceGoTSRPCClient struct {
}
func NewDefaultServiceGoTSRPCClient(url string) *HTTPServiceGoTSRPCClient {
return NewServiceGoTSRPCClient(url, "/service")
return NewServiceGoTSRPCClientWithOptions(url, "/service")
}
func NewServiceGoTSRPCClient(url string, endpoint string) *HTTPServiceGoTSRPCClient {
return NewServiceGoTSRPCClientWithClient(url, endpoint, nil)
return NewServiceGoTSRPCClientWithOptions(url, endpoint)
}
// Deprecated: Use NewServiceGoTSRPCClientWithOptions instead
func NewServiceGoTSRPCClientWithClient(url string, endpoint string, client *go_net_http.Client) *HTTPServiceGoTSRPCClient {
return &HTTPServiceGoTSRPCClient{
URL: url,
EndPoint: endpoint,
Client: gotsrpc.NewClientWithHttpClient(client),
Client: gotsrpc.NewBufferedClient(gotsrpc.WithHTTPClient(client)),
}
}
func NewServiceGoTSRPCClientWithOptions(url string, endpoint string, options ...gotsrpc.ClientOption) *HTTPServiceGoTSRPCClient {
return &HTTPServiceGoTSRPCClient{
URL: url,
EndPoint: endpoint,
Client: gotsrpc.NewBufferedClient(options...),
}
}
func (tsc *HTTPServiceGoTSRPCClient) InlineStruct(ctx go_context.Context) (e InlineStruct, clientErr error) {
args := []interface{}{}
reply := []interface{}{&e}