grpc

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 Get

func Get() *Grpc

func (*Grpc) Addr

func (g *Grpc) Addr() string

func (*Grpc) Init

func (g *Grpc) Init() error

func (*Grpc) Interceptors

func (g *Grpc) Interceptors() (interceptors []grpc.UnaryServerInterceptor)

Interceptors 返回 gRPC 服务器的一组拦截器

func (*Grpc) Name

func (g *Grpc) Name() string

func (*Grpc) ServerOpts

func (g *Grpc) ServerOpts() []grpc.ServerOption

func (*Grpc) Start

func (g *Grpc) Start(ctx context.Context)

func (*Grpc) Stop

func (g *Grpc) Stop(ctx context.Context) error

type ServiceInfoCtxKey

type ServiceInfoCtxKey struct{}

Jump to

Keyboard shortcuts

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