grpc_fx

package
v0.0.0-...-af9c1cf Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCServer

func NewGRPCServer(p GRPCServerParams) error

func NewGateway

func NewGateway(p GatewayParams) error

Types

type GRPCConfig

type GRPCConfig struct {
	Enabled bool   `json:"enabled" default:"true"`
	Addr    string `json:"addr" default:":7070"`
}

type GRPCServerInputResult

type GRPCServerInputResult struct {
	fx.Out

	UnaryInterceptors  []grpc.UnaryServerInterceptor  `group:"grpc_unary_server_interceptor,flatten"`
	StreamInterceptors []grpc.StreamServerInterceptor `group:"grpc_stream_server_interceptor,flatten"`
	Services           []RegisterFn                   `group:"service,flatten"`
}

type GRPCServerParams

type GRPCServerParams struct {
	fx.In

	Lifecycle fx.Lifecycle
	OnErrorCh chan error

	Log        *zap.SugaredLogger
	GRPCConfig GRPCConfig

	UnaryInterceptors  []grpc.UnaryServerInterceptor  `group:"grpc_unary_server_interceptor"`
	StreamInterceptors []grpc.StreamServerInterceptor `group:"grpc_stream_server_interceptor"`
	Services           []RegisterFn                   `group:"service"`
}

type GatewayConfig

type GatewayConfig struct {
	Enabled      bool          `json:"enabled" default:"true"`
	Addr         string        `json:"addr" default:":8080"`
	ReadTimeout  time.Duration `json:"read_timeout" default:"30s"`
	WriteTimeout time.Duration `json:"write_timeout" default:"30s"`
	IdleTimeout  time.Duration `json:"idle_timeout" default:"120s"`
}

type GatewayInputResult

type GatewayInputResult struct {
	fx.Out

	ServeMuxOptions []runtime.ServeMuxOption `group:"grpc_gateway_serve_mux_options,flatten"`
}

type GatewayParams

type GatewayParams struct {
	fx.In

	Lifecycle fx.Lifecycle
	OnErrorCh chan error

	Log            *zap.SugaredLogger
	TracerProvider trace.TracerProvider
	GRPCConfig     GRPCConfig
	GatewayConfig  GatewayConfig

	Services        []RegisterFn                      `group:"service"`
	ServeMuxOptions []runtime.ServeMuxOption          `group:"grpc_gateway_serve_mux_options"`
	HTTPMiddleware  []func(http.Handler) http.Handler `group:"http_middleware"`
}

type HandlerRegisterFn

type HandlerRegisterFn func(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

type RegisterFn

type RegisterFn func() (string, ServerRegisterFn, HandlerRegisterFn)

type ServerRegisterFn

type ServerRegisterFn func(*grpc.Server)

Jump to

Keyboard shortcuts

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