Documentation
¶
Index ¶
- func AddGrpcServer(name string, f func(server *grpc.Server), options ...ServerOption)
- func AddHttpServer(name string, handler http.Handler, options ...ServerOption)
- func AddServer(srv Server)
- func GetPubSubConf() *pubsub.PubSubConfig
- func InitAppConfig(filepath string)
- func Run() error
- type AppConf
- type ClientConf
- type ClientOption
- type ClientOptionFun
- type ClientOptions
- type Endpoint
- type GrpcClient
- type GrpcServer
- type HttpInterceptor
- type HttpServer
- type Server
- type ServerConf
- type ServerOption
- type ServerOptionFun
- type ServerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddGrpcServer ¶
func AddGrpcServer(name string, f func(server *grpc.Server), options ...ServerOption)
func AddHttpServer ¶
func AddHttpServer(name string, handler http.Handler, options ...ServerOption)
func GetPubSubConf ¶
func GetPubSubConf() *pubsub.PubSubConfig
func InitAppConfig ¶
func InitAppConfig(filepath string)
Types ¶
type AppConf ¶
type AppConf struct {
ServerList []*ServerConf `mapstructure:"server"`
Client *ClientConf `mapstructure:"client"`
PubSubConfig *pubsub.PubSubConfig `mapstructure:"pubsub"`
}
type ClientConf ¶
type ClientConf struct {
RequestTimeout int32 `mapstructure:"requestTimeout"`
}
func GetClientConf ¶
func GetClientConf() *ClientConf
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
func WithDialTarget ¶
func WithDialTarget(target string) ClientOption
func WithGrpcDialOptions ¶
func WithGrpcDialOptions(grpcDialOptions ...grpc.DialOption) ClientOption
type ClientOptionFun ¶
type ClientOptionFun func(*ClientOptions)
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
func NewGrpcClient ¶
func NewGrpcClient(name string, options ...ClientOption) (*GrpcClient, error)
func (*GrpcClient) Invoke ¶
func (c *GrpcClient) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error
func (*GrpcClient) NewStream ¶
func (c *GrpcClient) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func (*GrpcServer) Endpoint ¶
func (srv *GrpcServer) Endpoint() *Endpoint
func (*GrpcServer) Name ¶
func (srv *GrpcServer) Name() string
func (*GrpcServer) Shutdown ¶
func (srv *GrpcServer) Shutdown() error
type HttpInterceptor ¶
type HttpInterceptor func(w http.ResponseWriter, r *http.Request, handler http.HandlerFunc)
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func (*HttpServer) Endpoint ¶
func (srv *HttpServer) Endpoint() *Endpoint
func (*HttpServer) Name ¶
func (srv *HttpServer) Name() string
func (*HttpServer) ServeHTTP ¶
func (srv *HttpServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
func (*HttpServer) Shutdown ¶
func (srv *HttpServer) Shutdown() error
type ServerConf ¶
type ServerConf struct {
Name string `mapstructure:"name"`
Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
Weight int32 `mapstructure:"weight"`
Proxy string `mapstructure:"proxy"`
MaxRequestSecond int32 `mapstructure:"maxRequestSecond"`
}
func GetServerConf ¶
func GetServerConf(name string) *ServerConf
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
func WithGrpcServerOptions ¶
func WithGrpcServerOptions(grpcOptions ...grpc.ServerOption) ServerOption
func WithHttpInterceptors ¶
func WithHttpInterceptors(httpInterceptors ...HttpInterceptor) ServerOption
type ServerOptionFun ¶
type ServerOptionFun func(*ServerOptions)
type ServerOptions ¶
type ServerOptions struct {
// contains filtered or unexported fields
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.