grpc

package
v0.0.0-...-fc18315 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserServiceName    = "project-user"
	ProjectServiceName = "project-project"
)
View Source
const SCHEME = "etcd"

Variables

This section is empty.

Functions

func ClientWithProject

func ClientWithProject(register registry.Registry, balancerName string, interceptor ...grpc.UnaryClientInterceptor) (grpcProject.ProjectServiceClient, error)

func ClientWithUser

func ClientWithUser(register registry.Registry, balancerName string, interceptor ...grpc.UnaryClientInterceptor) (grpcUser.UserServiceClient, error)

func NewClient

func NewClient(register registry.Registry, balancerName, serviceName string, interceptor ...grpc.UnaryClientInterceptor) (*grpc.ClientConn, error)

NewClient 创建一个grpc客户端

Types

type Options

type Options func(s *Server)

func WithLogger

func WithLogger(log *logs.ZapLogger) Options

WithLogger 注入日志

func WithRegistry

func WithRegistry(r registry.Registry) Options

WithRegistry 注入注册中心

func WithUnaryInterceptor

func WithUnaryInterceptor(middleware ...grpc.UnaryServerInterceptor) Options

WithUnaryInterceptor 注入中间件

type RegisterFunc

type RegisterFunc func(s grpc.ServiceRegistrar)

type Resolver

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

func (*Resolver) Close

func (r *Resolver) Close()

func (*Resolver) ResolveNow

func (r *Resolver) ResolveNow(options resolver.ResolveNowOptions)

type ResolverBuilder

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

func NewResolverBuilder

func NewResolverBuilder(r registry.Registry) *ResolverBuilder

func (*ResolverBuilder) Build

func (*ResolverBuilder) Scheme

func (b *ResolverBuilder) Scheme() string

type Server

type Server struct {
	*grpc.Server // grpc服务
	// contains filtered or unexported fields
}

func NewServer

func NewServer(si registry.ServiceInstance, registerService RegisterFunc, opts ...Options) *Server

func (*Server) Close

func (s *Server) Close(sig os.Signal)

func (*Server) Start

func (s *Server) Start()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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