grpc

package
v2.0.33 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 10 Imported by: 26

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恢复
	Recovery bool `json:"recovery" yaml:"recovery" toml:"recovery" env:"RECOVERY"`
	// 开启Trace
	Trace bool `json:"trace" yaml:"trace" toml:"trace" env:"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) AddInterceptors

func (g *Grpc) AddInterceptors(interceptors ...grpc.UnaryServerInterceptor)

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)

func (*Grpc) IsEnable added in v2.0.8

func (g *Grpc) IsEnable() bool

func (*Grpc) Name

func (g *Grpc) Name() string

func (*Grpc) Priority added in v2.0.8

func (i *Grpc) Priority() int

func (*Grpc) Server added in v2.0.8

func (g *Grpc) Server() *grpc.Server

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