Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GRPCEndpointRegistrator ¶
GRPCEndpointRegistrator abstracts a mechanics of registering the gRPC service in the gRPC server.
type ListenerGRPC ¶
type ListenerGRPC struct {
// contains filtered or unexported fields
}
ListenerGRPC represents a struct that encapsulates a gRPC server listener.
func NewListenerGRPC ¶
func NewListenerGRPC(addr string, options ...Option[config]) (*ListenerGRPC, error)
NewListenerGRPC creates a new ListenerGRPC instance by creating a gRPC listener using a given address. It applies all the options to a default `applyOptionsGRPC` instance and sets the server options with the provided unary and stream interceptors. Finally, it returns the ListenerGRPC instance and potential error.
func (*ListenerGRPC) Mount ¶
func (l *ListenerGRPC) Mount(handlers ...GRPCEndpointRegistrator)
Mount the given handlers to the listener gRPC server.
type Option ¶
type Option[T config] func(o *T)
Option implements functional options pattern for the ListenerGRPC type. Represents a function which receive a pointer to the generic struct that represents a part of ListenerGRPC configuration and changes it default values to the given ones.
See the applyOptionsGRPC function to understand the configuration behaviour. Option functions should only be passed to ListenerGRPC constructor function NewListenerGRPC.
func WithLogger ¶
WithLogger sets the server logger.
func WithStreamInterceptors ¶
func WithStreamInterceptors(interceptors ...midkit.StreamInterceptor) Option[config]
WithStreamInterceptors is a function that takes a variable number of StreamInterceptor functions and returns an Option[config]. This function is used to add StreamInterceptors to the streamInterceptors field of the config struct.
func WithUnaryInterceptors ¶
func WithUnaryInterceptors(interceptors ...midkit.UnaryInterceptor) Option[config]
WithUnaryInterceptors is a function that takes a variable number of UnaryInterceptor functions and returns an Option[config]. This function is used to add UnaryInterceptors to the unaryInterceptors field of the config struct.