micro

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(s *Server)

func WithDialTimeout added in v0.0.5

func WithDialTimeout(timeout time.Duration) Option

func WithEndpoints added in v0.0.5

func WithEndpoints(endpoints []string) Option

func WithEtcdConfig added in v0.0.5

func WithEtcdConfig(config *clientv3.Config) Option

func WithGrpcListener added in v0.0.5

func WithGrpcListener(listener net.Listener) Option

func WithGrpcServer added in v0.0.5

func WithGrpcServer(grpcSvr *grpc.Server) Option

func WithService added in v0.0.5

func WithService(service *Service) Option

type Server added in v0.0.5

type Server struct {
	// contains filtered or unexported fields
}

func NewServer added in v0.0.5

func NewServer(opts ...Option) *Server

func (*Server) GetEtcdClient added in v0.0.5

func (s *Server) GetEtcdClient() *clientv3.Client

GetEtcdClient 获取etcd client

func (*Server) GetGrpcServer added in v0.0.5

func (s *Server) GetGrpcServer() *grpc.Server

GetGrpcServer 获取grpc server

func (*Server) GetService added in v0.0.5

func (s *Server) GetService() *Service

GetService 获取service

func (*Server) Init added in v0.0.5

func (s *Server) Init() error

func (*Server) RegisterService added in v0.0.5

func (s *Server) RegisterService() error

RegisterService 注册服务

func (*Server) ServiceDiscovery added in v0.0.5

func (s *Server) ServiceDiscovery(name string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

ServiceDiscovery 服务发现

func (*Server) Start added in v0.0.5

func (s *Server) Start() error

Start 启动grpc server

func (*Server) Stop added in v0.0.5

func (s *Server) Stop()

Stop 停止grpc server

func (*Server) UnRegisterService added in v0.0.5

func (s *Server) UnRegisterService() error

UnRegisterService 注销服务

type Service

type Service struct {
	// 服务名称
	ServiceName string
	// 服务地址
	ServiceAddr string
}

Service 服务

func NewService added in v0.0.5

func NewService(opts ...ServiceOption) *Service

type ServiceOption added in v0.0.5

type ServiceOption func(s *Service)

func WithServiceAddr added in v0.0.5

func WithServiceAddr(serviceAddr string) ServiceOption

func WithServiceName added in v0.0.5

func WithServiceName(serviceName string) ServiceOption

Jump to

Keyboard shortcuts

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