common

package
v0.0.0-...-b583e5f Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServName = "grpc_demo_srv"
)

Variables

This section is empty.

Functions

func NewResolver

func NewResolver(endpoints []string, service string) resolver.Builder

NewResolver return resolver builder service is service name

func PrivateIPv4

func PrivateIPv4() (net.IP, error)

Types

type Resolver

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

resolver is the implementaion of grpc.resolve.Builder Resolver 实现grpc的grpc.resolve.Builder接口的Build与Scheme方法

func (*Resolver) Build

Build to resolver.Resolver 实现grpc.resolve.Builder接口的方法

func (*Resolver) Close

func (r *Resolver) Close()

Close

func (*Resolver) ResolveNow

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

ResolveNow

func (*Resolver) Scheme

func (r *Resolver) Scheme() string

Scheme return etcd schema

type Service

type Service struct {
	ServiceInfo ServiceInfo
	// contains filtered or unexported fields
}

func NewService

func NewService(info ServiceInfo, etcdEndpoints []string) (service *Service, err error)

NewService 创建一个注册服务

func (*Service) Start

func (service *Service) Start() (err error)

Start 注册服务启动

func (*Service) Stop

func (service *Service) Stop()

type ServiceInfo

type ServiceInfo struct {
	Name string
	Addr string
}

服务信息

type StudentSrv

type StudentSrv struct {
	StudentList []*model.Student
	Version     string
}

func (*StudentSrv) AllStudent

func (srv *StudentSrv) AllStudent(e *empty.Empty, rev api.StudentSrv_AllStudentServer) error

func (*StudentSrv) NewStudent

func (srv *StudentSrv) NewStudent(ctx context.Context, s *model.Student) (*protos.Result, error)

func (*StudentSrv) QueryStudents

func (srv *StudentSrv) QueryStudents(student *api.QueryStudent, server api.StudentSrv_QueryStudentsServer) error

func (*StudentSrv) StudentByID

func (*StudentSrv) StudentInfo

func (srv *StudentSrv) StudentInfo(stream api.StudentSrv_StudentInfoServer) error

Jump to

Keyboard shortcuts

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