README
¶
grpc server
Generic grpc server.
Example of use
import "github.com/18721889353/sunshine/pkg/grpc/server"
port := 8282
registerFn := func(s *grpc.Server) {
pb.RegisterGreeterServer(s, &greeterServer{})
}
server.Run(port, registerFn,
//server.WithSecure(credentials),
//server.WithUnaryInterceptor(unaryInterceptors...),
//server.WithStreamInterceptor(streamInterceptors...),
//server.WithServiceRegister(func() {}),
)
select{}
Examples of practical use https://github.com/18721889353/grpc_examples/blob/main/usage/server/main.go
Documentation
¶
Overview ¶
Package server is generic grpc server-side.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option set server option
func WithSecure ¶
func WithSecure(credential credentials.TransportCredentials) Option
WithSecure set secure
func WithServiceRegister ¶
func WithServiceRegister(fn ServiceRegisterFn) Option
WithServiceRegister set service register
func WithStreamInterceptor ¶
func WithStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) Option
WithStreamInterceptor set stream interceptor
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptor set unary interceptor
Click to show internal directories.
Click to hide internal directories.