README
¶
grpc client
Generic grpc client.
Example of use
import "github.com/18721889353/sunshine/pkg/grpc/client"
conn, err := client.Dial(context.Background(), "127.0.0.1:8282",
//client.WithServiceDiscover(builder),
//client.WithLoadBalance(),
//client.WithSecure(credentials),
//client.WithUnaryInterceptor(unaryInterceptors...),
//client.WithStreamInterceptor(streamInterceptors...),
)
Examples of practical use https://github.com/18721889353/grpc_examples/blob/main/usage/client/main.go
Documentation
¶
Overview ¶
Package client is generic grpc client-side.
Index ¶
- func Dial(ctx context.Context, endpoint string, opts ...Option) (*grpc.ClientConn, error)
- type Option
- func WithLoadBalance() Option
- func WithSecure(credential credentials.TransportCredentials) Option
- func WithServiceDiscover(builders ...resolver.Builder) Option
- func WithStreamInterceptor(interceptors ...grpc.StreamClientInterceptor) Option
- func WithUnaryInterceptor(interceptors ...grpc.UnaryClientInterceptor) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option client option func
func WithSecure ¶
func WithSecure(credential credentials.TransportCredentials) Option
WithSecure set secure
func WithServiceDiscover ¶
WithServiceDiscover set service discover
func WithStreamInterceptor ¶
func WithStreamInterceptor(interceptors ...grpc.StreamClientInterceptor) Option
WithStreamInterceptor set stream interceptor
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(interceptors ...grpc.UnaryClientInterceptor) Option
WithUnaryInterceptor set unary interceptor
Click to show internal directories.
Click to hide internal directories.