Documentation ¶
Index ¶
- Constants
- type Grpc
- func (g *Grpc) AddInterceptors(interceptors ...grpc.UnaryServerInterceptor)
- func (g *Grpc) Addr() string
- func (g *Grpc) Init() error
- func (g *Grpc) Interceptors() (interceptors []grpc.UnaryServerInterceptor)
- func (g *Grpc) IsEnable() bool
- func (g *Grpc) Name() string
- func (i *Grpc) Priority() int
- func (g *Grpc) Server() *grpc.Server
- func (g *Grpc) ServerOpts() []grpc.ServerOption
- func (g *Grpc) Start(ctx context.Context)
- func (g *Grpc) Stop(ctx context.Context) error
- type ServiceInfoCtxKey
Constants ¶
View Source
const (
AppName = "grpc"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Grpc ¶
type Grpc struct { ioc.ObjectImpl // 开启GRPC服务 Enable *bool `json:"enable" yaml:"enable" toml:"enable" env:"ENABLE"` Host string `json:"host" yaml:"host" toml:"host" env:"HOST"` Port int `json:"port" yaml:"port" toml:"port" env:"PORT"` EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl" toml:"enable_ssl" env:"ENABLE_SSL"` CertFile string `json:"cert_file" yaml:"cert_file" toml:"cert_file" env:"CERT_FILE"` KeyFile string `json:"key_file" yaml:"key_file" toml:"key_file" env:"KEY_FILE"` // 开启recovery恢复 EnableRecovery bool `json:"enable_recovery" yaml:"enable_recovery" toml:"enable_recovery" env:"ENABLE_RECOVERY"` // 开启Trace EnableTrace bool `json:"enable_trace" yaml:"enable_trace" toml:"enable_trace" env:"ENABLE_TRACE"` // 启动后执行 PostStart func(context.Context) error `json:"-" yaml:"-" toml:"-" env:"-"` // 关闭前执行 PreStop func(context.Context) error `json:"-" yaml:"-" toml:"-" env:"-"` // contains filtered or unexported fields }
func (*Grpc) AddInterceptors ¶ added in v1.3.8
func (g *Grpc) AddInterceptors(interceptors ...grpc.UnaryServerInterceptor)
func (*Grpc) Interceptors ¶
func (g *Grpc) Interceptors() (interceptors []grpc.UnaryServerInterceptor)
Interceptors 返回 gRPC 服务器的一组拦截器
func (*Grpc) ServerOpts ¶
func (g *Grpc) ServerOpts() []grpc.ServerOption
type ServiceInfoCtxKey ¶
type ServiceInfoCtxKey struct{}
Click to show internal directories.
Click to hide internal directories.