mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
chore: update examples
This commit is contained in:
parent
1e1c201785
commit
d5709b5a4f
1
Makefile
1
Makefile
@ -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
|
||||
|
||||
@ -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}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user