Documentation ¶
Overview ¶
Package proto is a generated protocol buffer package.
It is generated from these files:
service.proto service_stream.proto
It has these top-level messages:
HelloRequest HelloReply SimpleRequest SimpleResponse StreamRequest StreamResponse
Index ¶
- func RegisterGreeterServiceServer(s *grpc.Server, srv GreeterServiceServer)
- func RegisterStreamServer(s *grpc.Server, srv StreamServer)
- type GreeterServiceClient
- type GreeterServiceServer
- type HelloReply
- type HelloReplyMultiError
- type HelloReplyValidationError
- type HelloRequest
- type HelloRequestMultiError
- type HelloRequestValidationError
- func (e HelloRequestValidationError) Cause() error
- func (e HelloRequestValidationError) Error() string
- func (e HelloRequestValidationError) ErrorName() string
- func (e HelloRequestValidationError) Field() string
- func (e HelloRequestValidationError) Key() bool
- func (e HelloRequestValidationError) Reason() string
- type SimpleRequest
- type SimpleRequestMultiError
- type SimpleRequestValidationError
- func (e SimpleRequestValidationError) Cause() error
- func (e SimpleRequestValidationError) Error() string
- func (e SimpleRequestValidationError) ErrorName() string
- func (e SimpleRequestValidationError) Field() string
- func (e SimpleRequestValidationError) Key() bool
- func (e SimpleRequestValidationError) Reason() string
- type SimpleResponse
- func (*SimpleResponse) Descriptor() ([]byte, []int)
- func (m *SimpleResponse) GetCode() int32
- func (m *SimpleResponse) GetValue() string
- func (*SimpleResponse) ProtoMessage()
- func (m *SimpleResponse) Reset()
- func (m *SimpleResponse) String() string
- func (m *SimpleResponse) Validate() error
- func (m *SimpleResponse) ValidateAll() error
- type SimpleResponseMultiError
- type SimpleResponseValidationError
- func (e SimpleResponseValidationError) Cause() error
- func (e SimpleResponseValidationError) Error() string
- func (e SimpleResponseValidationError) ErrorName() string
- func (e SimpleResponseValidationError) Field() string
- func (e SimpleResponseValidationError) Key() bool
- func (e SimpleResponseValidationError) Reason() string
- type StreamClient
- type StreamRequest
- type StreamRequestMultiError
- type StreamRequestValidationError
- func (e StreamRequestValidationError) Cause() error
- func (e StreamRequestValidationError) Error() string
- func (e StreamRequestValidationError) ErrorName() string
- func (e StreamRequestValidationError) Field() string
- func (e StreamRequestValidationError) Key() bool
- func (e StreamRequestValidationError) Reason() string
- type StreamResponse
- type StreamResponseMultiError
- type StreamResponseValidationError
- func (e StreamResponseValidationError) Cause() error
- func (e StreamResponseValidationError) Error() string
- func (e StreamResponseValidationError) ErrorName() string
- func (e StreamResponseValidationError) Field() string
- func (e StreamResponseValidationError) Key() bool
- func (e StreamResponseValidationError) Reason() string
- type StreamServer
- type Stream_ConversationsClient
- type Stream_ConversationsServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterGreeterServiceServer ¶
func RegisterGreeterServiceServer(s *grpc.Server, srv GreeterServiceServer)
func RegisterStreamServer ¶
func RegisterStreamServer(s *grpc.Server, srv StreamServer)
Types ¶
type GreeterServiceClient ¶
type GreeterServiceClient interface {
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
}
func NewGreeterServiceClient ¶
func NewGreeterServiceClient(cc *grpc.ClientConn) GreeterServiceClient
type GreeterServiceServer ¶
type GreeterServiceServer interface {
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
}
type HelloReply ¶
type HelloReply struct {
Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
}
func (*HelloReply) Descriptor ¶
func (*HelloReply) Descriptor() ([]byte, []int)
func (*HelloReply) GetMessage ¶
func (m *HelloReply) GetMessage() string
func (*HelloReply) ProtoMessage ¶
func (*HelloReply) ProtoMessage()
func (*HelloReply) Reset ¶
func (m *HelloReply) Reset()
func (*HelloReply) String ¶
func (m *HelloReply) String() string
func (*HelloReply) Validate ¶
func (m *HelloReply) Validate() error
Validate checks the field values on HelloReply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*HelloReply) ValidateAll ¶
func (m *HelloReply) ValidateAll() error
ValidateAll checks the field values on HelloReply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HelloReplyMultiError, or nil if none found.
type HelloReplyMultiError ¶
type HelloReplyMultiError []error
HelloReplyMultiError is an error wrapping multiple validation errors returned by HelloReply.ValidateAll() if the designated constraints aren't met.
func (HelloReplyMultiError) AllErrors ¶
func (m HelloReplyMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (HelloReplyMultiError) Error ¶
func (m HelloReplyMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type HelloReplyValidationError ¶
type HelloReplyValidationError struct {
// contains filtered or unexported fields
}
HelloReplyValidationError is the validation error returned by HelloReply.Validate if the designated constraints aren't met.
func (HelloReplyValidationError) Cause ¶
func (e HelloReplyValidationError) Cause() error
Cause function returns cause value.
func (HelloReplyValidationError) Error ¶
func (e HelloReplyValidationError) Error() string
Error satisfies the builtin error interface
func (HelloReplyValidationError) ErrorName ¶
func (e HelloReplyValidationError) ErrorName() string
ErrorName returns error name.
func (HelloReplyValidationError) Field ¶
func (e HelloReplyValidationError) Field() string
Field function returns field value.
func (HelloReplyValidationError) Key ¶
func (e HelloReplyValidationError) Key() bool
Key function returns key value.
func (HelloReplyValidationError) Reason ¶
func (e HelloReplyValidationError) Reason() string
Reason function returns reason value.
type HelloRequest ¶
type HelloRequest struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
}
func (*HelloRequest) Descriptor ¶
func (*HelloRequest) Descriptor() ([]byte, []int)
func (*HelloRequest) GetName ¶
func (m *HelloRequest) GetName() string
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) Reset ¶
func (m *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (m *HelloRequest) String() string
func (*HelloRequest) Validate ¶
func (m *HelloRequest) Validate() error
Validate checks the field values on HelloRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*HelloRequest) ValidateAll ¶
func (m *HelloRequest) ValidateAll() error
ValidateAll checks the field values on HelloRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HelloRequestMultiError, or nil if none found.
type HelloRequestMultiError ¶
type HelloRequestMultiError []error
HelloRequestMultiError is an error wrapping multiple validation errors returned by HelloRequest.ValidateAll() if the designated constraints aren't met.
func (HelloRequestMultiError) AllErrors ¶
func (m HelloRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (HelloRequestMultiError) Error ¶
func (m HelloRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type HelloRequestValidationError ¶
type HelloRequestValidationError struct {
// contains filtered or unexported fields
}
HelloRequestValidationError is the validation error returned by HelloRequest.Validate if the designated constraints aren't met.
func (HelloRequestValidationError) Cause ¶
func (e HelloRequestValidationError) Cause() error
Cause function returns cause value.
func (HelloRequestValidationError) Error ¶
func (e HelloRequestValidationError) Error() string
Error satisfies the builtin error interface
func (HelloRequestValidationError) ErrorName ¶
func (e HelloRequestValidationError) ErrorName() string
ErrorName returns error name.
func (HelloRequestValidationError) Field ¶
func (e HelloRequestValidationError) Field() string
Field function returns field value.
func (HelloRequestValidationError) Key ¶
func (e HelloRequestValidationError) Key() bool
Key function returns key value.
func (HelloRequestValidationError) Reason ¶
func (e HelloRequestValidationError) Reason() string
Reason function returns reason value.
type SimpleRequest ¶
type SimpleRequest struct { // 定义发送的参数,采用驼峰命名方式,小写加下划线,如:student_name // 参数类型 参数名 标识号(不可重复) Data string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` }
定义发送请求信息
func (*SimpleRequest) Descriptor ¶
func (*SimpleRequest) Descriptor() ([]byte, []int)
func (*SimpleRequest) GetData ¶
func (m *SimpleRequest) GetData() string
func (*SimpleRequest) ProtoMessage ¶
func (*SimpleRequest) ProtoMessage()
func (*SimpleRequest) Reset ¶
func (m *SimpleRequest) Reset()
func (*SimpleRequest) String ¶
func (m *SimpleRequest) String() string
func (*SimpleRequest) Validate ¶
func (m *SimpleRequest) Validate() error
Validate checks the field values on SimpleRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*SimpleRequest) ValidateAll ¶
func (m *SimpleRequest) ValidateAll() error
ValidateAll checks the field values on SimpleRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SimpleRequestMultiError, or nil if none found.
type SimpleRequestMultiError ¶
type SimpleRequestMultiError []error
SimpleRequestMultiError is an error wrapping multiple validation errors returned by SimpleRequest.ValidateAll() if the designated constraints aren't met.
func (SimpleRequestMultiError) AllErrors ¶
func (m SimpleRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (SimpleRequestMultiError) Error ¶
func (m SimpleRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type SimpleRequestValidationError ¶
type SimpleRequestValidationError struct {
// contains filtered or unexported fields
}
SimpleRequestValidationError is the validation error returned by SimpleRequest.Validate if the designated constraints aren't met.
func (SimpleRequestValidationError) Cause ¶
func (e SimpleRequestValidationError) Cause() error
Cause function returns cause value.
func (SimpleRequestValidationError) Error ¶
func (e SimpleRequestValidationError) Error() string
Error satisfies the builtin error interface
func (SimpleRequestValidationError) ErrorName ¶
func (e SimpleRequestValidationError) ErrorName() string
ErrorName returns error name.
func (SimpleRequestValidationError) Field ¶
func (e SimpleRequestValidationError) Field() string
Field function returns field value.
func (SimpleRequestValidationError) Key ¶
func (e SimpleRequestValidationError) Key() bool
Key function returns key value.
func (SimpleRequestValidationError) Reason ¶
func (e SimpleRequestValidationError) Reason() string
Reason function returns reason value.
type SimpleResponse ¶
type SimpleResponse struct { // 定义接收的参数 // 参数类型 参数名 标识号(不可重复) Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` }
定义响应信息
func (*SimpleResponse) Descriptor ¶
func (*SimpleResponse) Descriptor() ([]byte, []int)
func (*SimpleResponse) GetCode ¶
func (m *SimpleResponse) GetCode() int32
func (*SimpleResponse) GetValue ¶
func (m *SimpleResponse) GetValue() string
func (*SimpleResponse) ProtoMessage ¶
func (*SimpleResponse) ProtoMessage()
func (*SimpleResponse) Reset ¶
func (m *SimpleResponse) Reset()
func (*SimpleResponse) String ¶
func (m *SimpleResponse) String() string
func (*SimpleResponse) Validate ¶
func (m *SimpleResponse) Validate() error
Validate checks the field values on SimpleResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*SimpleResponse) ValidateAll ¶
func (m *SimpleResponse) ValidateAll() error
ValidateAll checks the field values on SimpleResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SimpleResponseMultiError, or nil if none found.
type SimpleResponseMultiError ¶
type SimpleResponseMultiError []error
SimpleResponseMultiError is an error wrapping multiple validation errors returned by SimpleResponse.ValidateAll() if the designated constraints aren't met.
func (SimpleResponseMultiError) AllErrors ¶
func (m SimpleResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (SimpleResponseMultiError) Error ¶
func (m SimpleResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type SimpleResponseValidationError ¶
type SimpleResponseValidationError struct {
// contains filtered or unexported fields
}
SimpleResponseValidationError is the validation error returned by SimpleResponse.Validate if the designated constraints aren't met.
func (SimpleResponseValidationError) Cause ¶
func (e SimpleResponseValidationError) Cause() error
Cause function returns cause value.
func (SimpleResponseValidationError) Error ¶
func (e SimpleResponseValidationError) Error() string
Error satisfies the builtin error interface
func (SimpleResponseValidationError) ErrorName ¶
func (e SimpleResponseValidationError) ErrorName() string
ErrorName returns error name.
func (SimpleResponseValidationError) Field ¶
func (e SimpleResponseValidationError) Field() string
Field function returns field value.
func (SimpleResponseValidationError) Key ¶
func (e SimpleResponseValidationError) Key() bool
Key function returns key value.
func (SimpleResponseValidationError) Reason ¶
func (e SimpleResponseValidationError) Reason() string
Reason function returns reason value.
type StreamClient ¶
type StreamClient interface { Route(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) // 双向流式rpc,同时在请求参数前和响应参数前加上stream Conversations(ctx context.Context, opts ...grpc.CallOption) (Stream_ConversationsClient, error) }
func NewStreamClient ¶
func NewStreamClient(cc *grpc.ClientConn) StreamClient
type StreamRequest ¶
type StreamRequest struct { // 流请求参数 Question string `protobuf:"bytes,1,opt,name=question" json:"question,omitempty"` }
定义流式请求信息
func (*StreamRequest) Descriptor ¶
func (*StreamRequest) Descriptor() ([]byte, []int)
func (*StreamRequest) GetQuestion ¶
func (m *StreamRequest) GetQuestion() string
func (*StreamRequest) ProtoMessage ¶
func (*StreamRequest) ProtoMessage()
func (*StreamRequest) Reset ¶
func (m *StreamRequest) Reset()
func (*StreamRequest) String ¶
func (m *StreamRequest) String() string
func (*StreamRequest) Validate ¶
func (m *StreamRequest) Validate() error
Validate checks the field values on StreamRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*StreamRequest) ValidateAll ¶
func (m *StreamRequest) ValidateAll() error
ValidateAll checks the field values on StreamRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StreamRequestMultiError, or nil if none found.
type StreamRequestMultiError ¶
type StreamRequestMultiError []error
StreamRequestMultiError is an error wrapping multiple validation errors returned by StreamRequest.ValidateAll() if the designated constraints aren't met.
func (StreamRequestMultiError) AllErrors ¶
func (m StreamRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (StreamRequestMultiError) Error ¶
func (m StreamRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type StreamRequestValidationError ¶
type StreamRequestValidationError struct {
// contains filtered or unexported fields
}
StreamRequestValidationError is the validation error returned by StreamRequest.Validate if the designated constraints aren't met.
func (StreamRequestValidationError) Cause ¶
func (e StreamRequestValidationError) Cause() error
Cause function returns cause value.
func (StreamRequestValidationError) Error ¶
func (e StreamRequestValidationError) Error() string
Error satisfies the builtin error interface
func (StreamRequestValidationError) ErrorName ¶
func (e StreamRequestValidationError) ErrorName() string
ErrorName returns error name.
func (StreamRequestValidationError) Field ¶
func (e StreamRequestValidationError) Field() string
Field function returns field value.
func (StreamRequestValidationError) Key ¶
func (e StreamRequestValidationError) Key() bool
Key function returns key value.
func (StreamRequestValidationError) Reason ¶
func (e StreamRequestValidationError) Reason() string
Reason function returns reason value.
type StreamResponse ¶
type StreamResponse struct { // 流响应数据 Answer string `protobuf:"bytes,1,opt,name=answer" json:"answer,omitempty"` }
定义流式响应信息
func (*StreamResponse) Descriptor ¶
func (*StreamResponse) Descriptor() ([]byte, []int)
func (*StreamResponse) GetAnswer ¶
func (m *StreamResponse) GetAnswer() string
func (*StreamResponse) ProtoMessage ¶
func (*StreamResponse) ProtoMessage()
func (*StreamResponse) Reset ¶
func (m *StreamResponse) Reset()
func (*StreamResponse) String ¶
func (m *StreamResponse) String() string
func (*StreamResponse) Validate ¶
func (m *StreamResponse) Validate() error
Validate checks the field values on StreamResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*StreamResponse) ValidateAll ¶
func (m *StreamResponse) ValidateAll() error
ValidateAll checks the field values on StreamResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StreamResponseMultiError, or nil if none found.
type StreamResponseMultiError ¶
type StreamResponseMultiError []error
StreamResponseMultiError is an error wrapping multiple validation errors returned by StreamResponse.ValidateAll() if the designated constraints aren't met.
func (StreamResponseMultiError) AllErrors ¶
func (m StreamResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (StreamResponseMultiError) Error ¶
func (m StreamResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type StreamResponseValidationError ¶
type StreamResponseValidationError struct {
// contains filtered or unexported fields
}
StreamResponseValidationError is the validation error returned by StreamResponse.Validate if the designated constraints aren't met.
func (StreamResponseValidationError) Cause ¶
func (e StreamResponseValidationError) Cause() error
Cause function returns cause value.
func (StreamResponseValidationError) Error ¶
func (e StreamResponseValidationError) Error() string
Error satisfies the builtin error interface
func (StreamResponseValidationError) ErrorName ¶
func (e StreamResponseValidationError) ErrorName() string
ErrorName returns error name.
func (StreamResponseValidationError) Field ¶
func (e StreamResponseValidationError) Field() string
Field function returns field value.
func (StreamResponseValidationError) Key ¶
func (e StreamResponseValidationError) Key() bool
Key function returns key value.
func (StreamResponseValidationError) Reason ¶
func (e StreamResponseValidationError) Reason() string
Reason function returns reason value.
type StreamServer ¶
type StreamServer interface { Route(context.Context, *SimpleRequest) (*SimpleResponse, error) // 双向流式rpc,同时在请求参数前和响应参数前加上stream Conversations(Stream_ConversationsServer) error }
type Stream_ConversationsClient ¶
type Stream_ConversationsClient interface { Send(*StreamRequest) error Recv() (*StreamResponse, error) grpc.ClientStream }
type Stream_ConversationsServer ¶
type Stream_ConversationsServer interface { Send(*StreamResponse) error Recv() (*StreamRequest, error) grpc.ServerStream }