genericclient

package
v0.15.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2025 License: Apache-2.0 Imports: 12 Imported by: 56

Documentation

Overview

Package genericclient ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamingServiceInfo added in v0.12.0

func StreamingServiceInfo(g generic.Generic) *serviceinfo.ServiceInfo

Deprecated, use generic.ServiceInfoWithGeneric instead

Types

type BidiStreamingClient added in v0.14.0

type BidiStreamingClient interface {
	// Send sends a message to the server.
	Send(ctx context.Context, req interface{}) error
	// Recv receives a message from the server.
	Recv(ctx context.Context) (interface{}, error)
	// Header inherits from the underlying streaming.ClientStream.
	Header() (streaming.Header, error)
	// Trailer inherits from the underlying streaming.ClientStream.
	Trailer() (streaming.Trailer, error)
	// CloseSend inherits from the underlying streaming.ClientStream.
	CloseSend(ctx context.Context) error
	// Context inherits from the underlying streaming.ClientStream.
	Context() context.Context
	// Streaming returns the underlying streaming.ClientStream.
	Streaming() streaming.ClientStream
}

BidiStreamingClient define client side generic bidirectional streaming APIs

type BidirectionalStreaming added in v0.12.0

type BidirectionalStreaming interface {
	streaming.Stream
	Send(req interface{}) error
	Recv() (resp interface{}, err error)
}

func NewBidirectionalStreaming added in v0.12.0

func NewBidirectionalStreaming(ctx context.Context, genericCli Client, method string, callOpts ...callopt.Option) (BidirectionalStreaming, error)

type Client

type Client interface {
	generic.Closer

	// GenericCall generic call
	GenericCall(ctx context.Context, method string, request interface{}, callOptions ...callopt.Option) (response interface{}, err error)
	// ClientStreaming creates an implementation of ClientStreamingClient
	ClientStreaming(ctx context.Context, method string, callOptions ...streamcall.Option) (ClientStreamingClient, error)
	// ServerStreaming creates an implementation of ServerStreamingClient
	ServerStreaming(ctx context.Context, method string, req interface{}, callOptions ...streamcall.Option) (ServerStreamingClient, error)
	// BidirectionalStreaming creates an implementation of BidiStreamingClient
	BidirectionalStreaming(ctx context.Context, method string, callOptions ...streamcall.Option) (BidiStreamingClient, error)
}

Client generic client

func NewClient

func NewClient(destService string, g generic.Generic, opts ...client.Option) (Client, error)

NewClient create a generic client

func NewClientWithServiceInfo

func NewClientWithServiceInfo(destService string, g generic.Generic, svcInfo *serviceinfo.ServiceInfo, opts ...client.Option) (Client, error)

NewClientWithServiceInfo create a generic client with serviceInfo

func NewStreamingClient deprecated added in v0.12.0

func NewStreamingClient(destService string, g generic.Generic, opts ...client.Option) (Client, error)

Deprecated: use NewClient instead.

func NewStreamingClientWithServiceInfo deprecated added in v0.12.0

func NewStreamingClientWithServiceInfo(destService string, g generic.Generic, svcInfo *serviceinfo.ServiceInfo, opts ...client.Option) (Client, error)

Deprecated: use NewClientWithServiceInfo instead.

type ClientStreaming added in v0.12.0

type ClientStreaming interface {
	streaming.Stream
	Send(req interface{}) error
	CloseAndRecv() (resp interface{}, err error)
}

func NewClientStreaming added in v0.12.0

func NewClientStreaming(ctx context.Context, genericCli Client, method string, callOpts ...callopt.Option) (ClientStreaming, error)

type ClientStreamingClient added in v0.14.0

type ClientStreamingClient interface {
	// Send sends a message to the server.
	Send(ctx context.Context, req interface{}) error
	// CloseAndRecv closes the send direction of the stream and returns the response from the server.
	CloseAndRecv(ctx context.Context) (interface{}, error)
	// Header inherits from the underlying streaming.ClientStream.
	Header() (streaming.Header, error)
	// Trailer inherits from the underlying streaming.ClientStream.
	Trailer() (streaming.Trailer, error)
	// CloseSend inherits from the underlying streaming.ClientStream.
	CloseSend(ctx context.Context) error
	// Context inherits from the underlying streaming.ClientStream.
	Context() context.Context
	// Streaming returns the underlying streaming.ClientStream.
	Streaming() streaming.ClientStream
}

ClientStreamingClient define client side generic client streaming APIs

type ServerStreaming added in v0.12.0

type ServerStreaming interface {
	streaming.Stream
	Recv() (resp interface{}, err error)
}

func NewServerStreaming added in v0.12.0

func NewServerStreaming(ctx context.Context, genericCli Client, method string, req interface{}, callOpts ...callopt.Option) (ServerStreaming, error)

type ServerStreamingClient added in v0.14.0

type ServerStreamingClient interface {
	// Recv receives a message from the server.
	Recv(ctx context.Context) (interface{}, error)
	// Header inherits from the underlying streaming.ClientStream.
	Header() (streaming.Header, error)
	// Trailer inherits from the underlying streaming.ClientStream.
	Trailer() (streaming.Trailer, error)
	// CloseSend inherits from the underlying streaming.ClientStream.
	CloseSend(ctx context.Context) error
	// Context inherits from the underlying streaming.ClientStream.
	Context() context.Context
	// Streaming returns the underlying streaming.ClientStream.
	Streaming() streaming.ClientStream
}

ServerStreamingClient define client side generic server streaming APIs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL