proto

package
v0.0.0-...-625ea8d Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

protoc

可以从 https://github.com/protocolbuffers/protobuf/releases 页面下载

比如:

protoc-gen-vmicro

生成 pb.go 文件

比如,拷贝 protoc 、 protoc-gen-vmicro 至本目录下。执行:

  • Windows

    protoc -I. --vmicro_out=. greeter.proto
    
  • Linux

    export PATH=$PATH:$PWD
    protoc -I. --vmicro_out=. greeter.proto
    

即可生成 greeter.pb.go

如果带有 broadcast 选项的,参考 g.bat 、 g.sh

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSayHandler

func RegisterSayHandler(s server.Server, hdlr SayHandler) error

Types

type Request

type Request struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetName

func (m *Request) GetName() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type Response

type Response struct {
	Msg                  string   `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) GetMsg

func (m *Response) GetMsg() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Response) XXX_Merge

func (m *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

func (m *Response) XXX_Unmarshal(b []byte) error

type SayCallback

type SayCallback interface {
	Ping(ctx context.Context, req *Request, rsp *Response)
}

type SayHandler

type SayHandler interface {
	BroadcastHello(ctx context.Context, req *Request, rsp *micro.NoReply) error
	Ping(ctx context.Context, req *Request, rsp *Response) error
}

type SayService

type SayService interface {
	BroadcastHello(ctx context.Context, req *Request, opts ...client.CallOption)
	Ping(ctx context.Context, req *Request, opts ...client.CallOption) error
}

func NewSayService

func NewSayService(name string, hdcb SayCallback, c client.Client) SayService

Jump to

Keyboard shortcuts

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