Documentation
¶
Index ¶
- Variables
- func Register(chatService *service.ChatService, ...)
- func RegisterChatServer(s grpc.ServiceRegistrar, srv ChatServer)
- type ChatClient
- type ChatRequest
- type ChatResponse
- type ChatServer
- type Chat_RetrieveHistoryClient
- type Chat_RetrieveHistoryServer
- type Chat_SendMessageStreamClient
- type Chat_SendMessageStreamServer
- type GrpcServer
- func (g *GrpcServer) CreateChat(ctx context.Context, chat *ChatRequest) (*ChatResponse, error)
- func (g *GrpcServer) RetrieveHistory(_ *HistoryRetrieveRequest, stream Chat_RetrieveHistoryServer) error
- func (g *GrpcServer) SendMessage(ctx context.Context, msg *MessageRequest) (*MessageResponse, error)
- func (g *GrpcServer) SendMessageStream(msg *MessageRequest, stream Chat_SendMessageStreamServer) error
- type HistoryRetrieveRequest
- type HistoryRetrieveResponse
- func (*HistoryRetrieveResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HistoryRetrieveResponse) GetChats() []*HistoryRetrieveResponseChat
- func (*HistoryRetrieveResponse) ProtoMessage()
- func (x *HistoryRetrieveResponse) ProtoReflect() protoreflect.Message
- func (x *HistoryRetrieveResponse) Reset()
- func (x *HistoryRetrieveResponse) String() string
- type HistoryRetrieveResponseChat
- func (*HistoryRetrieveResponseChat) Descriptor() ([]byte, []int)deprecated
- func (x *HistoryRetrieveResponseChat) GetChatId() string
- func (x *HistoryRetrieveResponseChat) GetMessages() []*HistoryRetrieveResponseChatMsg
- func (*HistoryRetrieveResponseChat) ProtoMessage()
- func (x *HistoryRetrieveResponseChat) ProtoReflect() protoreflect.Message
- func (x *HistoryRetrieveResponseChat) Reset()
- func (x *HistoryRetrieveResponseChat) String() string
- type HistoryRetrieveResponseChatMsg
- func (*HistoryRetrieveResponseChatMsg) Descriptor() ([]byte, []int)deprecated
- func (x *HistoryRetrieveResponseChatMsg) GetAuthor() string
- func (x *HistoryRetrieveResponseChatMsg) GetContent() string
- func (x *HistoryRetrieveResponseChatMsg) GetTimestamp() int64
- func (*HistoryRetrieveResponseChatMsg) ProtoMessage()
- func (x *HistoryRetrieveResponseChatMsg) ProtoReflect() protoreflect.Message
- func (x *HistoryRetrieveResponseChatMsg) Reset()
- func (x *HistoryRetrieveResponseChatMsg) String() string
- type MessageRequest
- func (*MessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *MessageRequest) GetChatId() string
- func (x *MessageRequest) GetContent() string
- func (*MessageRequest) ProtoMessage()
- func (x *MessageRequest) ProtoReflect() protoreflect.Message
- func (x *MessageRequest) Reset()
- func (x *MessageRequest) String() string
- type MessageResponse
- func (*MessageResponse) Descriptor() ([]byte, []int)deprecated
- func (x *MessageResponse) GetAuthor() string
- func (x *MessageResponse) GetContent() string
- func (*MessageResponse) ProtoMessage()
- func (x *MessageResponse) ProtoReflect() protoreflect.Message
- func (x *MessageResponse) Reset()
- func (x *MessageResponse) String() string
- type UnimplementedChatServer
- func (UnimplementedChatServer) CreateChat(context.Context, *ChatRequest) (*ChatResponse, error)
- func (UnimplementedChatServer) RetrieveHistory(*HistoryRetrieveRequest, Chat_RetrieveHistoryServer) error
- func (UnimplementedChatServer) SendMessage(context.Context, *MessageRequest) (*MessageResponse, error)
- func (UnimplementedChatServer) SendMessageStream(*MessageRequest, Chat_SendMessageStreamServer) error
- type UnsafeChatServer
Constants ¶
This section is empty.
Variables ¶
var Chat_ServiceDesc = grpc.ServiceDesc{ ServiceName: "chat.Chat", HandlerType: (*ChatServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateChat", Handler: _Chat_CreateChat_Handler, }, { MethodName: "SendMessage", Handler: _Chat_SendMessage_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "SendMessageStream", Handler: _Chat_SendMessageStream_Handler, ServerStreams: true, }, { StreamName: "RetrieveHistory", Handler: _Chat_RetrieveHistory_Handler, ServerStreams: true, }, }, Metadata: "ports/gRPC/server.proto", }
Chat_ServiceDesc is the grpc.ServiceDesc for Chat service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_ports_gRPC_server_proto protoreflect.FileDescriptor
Functions ¶
func Register ¶
func Register(chatService *service.ChatService, historyRetrieveService *service.HistoryRetrieveService, host string, port int)
func RegisterChatServer ¶
func RegisterChatServer(s grpc.ServiceRegistrar, srv ChatServer)
Types ¶
type ChatClient ¶
type ChatClient interface { CreateChat(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (*ChatResponse, error) SendMessage(ctx context.Context, in *MessageRequest, opts ...grpc.CallOption) (*MessageResponse, error) SendMessageStream(ctx context.Context, in *MessageRequest, opts ...grpc.CallOption) (Chat_SendMessageStreamClient, error) RetrieveHistory(ctx context.Context, in *HistoryRetrieveRequest, opts ...grpc.CallOption) (Chat_RetrieveHistoryClient, error) }
ChatClient is the client API for Chat service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewChatClient ¶
func NewChatClient(cc grpc.ClientConnInterface) ChatClient
type ChatRequest ¶
type ChatRequest struct {
// contains filtered or unexported fields
}
func (*ChatRequest) Descriptor
deprecated
func (*ChatRequest) Descriptor() ([]byte, []int)
Deprecated: Use ChatRequest.ProtoReflect.Descriptor instead.
func (*ChatRequest) ProtoMessage ¶
func (*ChatRequest) ProtoMessage()
func (*ChatRequest) ProtoReflect ¶
func (x *ChatRequest) ProtoReflect() protoreflect.Message
func (*ChatRequest) Reset ¶
func (x *ChatRequest) Reset()
func (*ChatRequest) String ¶
func (x *ChatRequest) String() string
type ChatResponse ¶
type ChatResponse struct { ChatId string `protobuf:"bytes,1,opt,name=chatId,proto3" json:"chatId,omitempty"` // contains filtered or unexported fields }
func (*ChatResponse) Descriptor
deprecated
func (*ChatResponse) Descriptor() ([]byte, []int)
Deprecated: Use ChatResponse.ProtoReflect.Descriptor instead.
func (*ChatResponse) GetChatId ¶
func (x *ChatResponse) GetChatId() string
func (*ChatResponse) ProtoMessage ¶
func (*ChatResponse) ProtoMessage()
func (*ChatResponse) ProtoReflect ¶
func (x *ChatResponse) ProtoReflect() protoreflect.Message
func (*ChatResponse) Reset ¶
func (x *ChatResponse) Reset()
func (*ChatResponse) String ¶
func (x *ChatResponse) String() string
type ChatServer ¶
type ChatServer interface { CreateChat(context.Context, *ChatRequest) (*ChatResponse, error) SendMessage(context.Context, *MessageRequest) (*MessageResponse, error) SendMessageStream(*MessageRequest, Chat_SendMessageStreamServer) error RetrieveHistory(*HistoryRetrieveRequest, Chat_RetrieveHistoryServer) error // contains filtered or unexported methods }
ChatServer is the server API for Chat service. All implementations must embed UnimplementedChatServer for forward compatibility
type Chat_RetrieveHistoryClient ¶
type Chat_RetrieveHistoryClient interface { Recv() (*HistoryRetrieveResponse, error) grpc.ClientStream }
type Chat_RetrieveHistoryServer ¶
type Chat_RetrieveHistoryServer interface { Send(*HistoryRetrieveResponse) error grpc.ServerStream }
type Chat_SendMessageStreamClient ¶
type Chat_SendMessageStreamClient interface { Recv() (*MessageResponse, error) grpc.ClientStream }
type Chat_SendMessageStreamServer ¶
type Chat_SendMessageStreamServer interface { Send(*MessageResponse) error grpc.ServerStream }
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func (*GrpcServer) CreateChat ¶
func (g *GrpcServer) CreateChat(ctx context.Context, chat *ChatRequest) (*ChatResponse, error)
func (*GrpcServer) RetrieveHistory ¶
func (g *GrpcServer) RetrieveHistory(_ *HistoryRetrieveRequest, stream Chat_RetrieveHistoryServer) error
func (*GrpcServer) SendMessage ¶
func (g *GrpcServer) SendMessage(ctx context.Context, msg *MessageRequest) (*MessageResponse, error)
func (*GrpcServer) SendMessageStream ¶
func (g *GrpcServer) SendMessageStream(msg *MessageRequest, stream Chat_SendMessageStreamServer) error
type HistoryRetrieveRequest ¶
type HistoryRetrieveRequest struct {
// contains filtered or unexported fields
}
func (*HistoryRetrieveRequest) Descriptor
deprecated
func (*HistoryRetrieveRequest) Descriptor() ([]byte, []int)
Deprecated: Use HistoryRetrieveRequest.ProtoReflect.Descriptor instead.
func (*HistoryRetrieveRequest) ProtoMessage ¶
func (*HistoryRetrieveRequest) ProtoMessage()
func (*HistoryRetrieveRequest) ProtoReflect ¶
func (x *HistoryRetrieveRequest) ProtoReflect() protoreflect.Message
func (*HistoryRetrieveRequest) Reset ¶
func (x *HistoryRetrieveRequest) Reset()
func (*HistoryRetrieveRequest) String ¶
func (x *HistoryRetrieveRequest) String() string
type HistoryRetrieveResponse ¶
type HistoryRetrieveResponse struct { Chats []*HistoryRetrieveResponseChat `protobuf:"bytes,6,rep,name=chats,proto3" json:"chats,omitempty"` // contains filtered or unexported fields }
func (*HistoryRetrieveResponse) Descriptor
deprecated
func (*HistoryRetrieveResponse) Descriptor() ([]byte, []int)
Deprecated: Use HistoryRetrieveResponse.ProtoReflect.Descriptor instead.
func (*HistoryRetrieveResponse) GetChats ¶
func (x *HistoryRetrieveResponse) GetChats() []*HistoryRetrieveResponseChat
func (*HistoryRetrieveResponse) ProtoMessage ¶
func (*HistoryRetrieveResponse) ProtoMessage()
func (*HistoryRetrieveResponse) ProtoReflect ¶
func (x *HistoryRetrieveResponse) ProtoReflect() protoreflect.Message
func (*HistoryRetrieveResponse) Reset ¶
func (x *HistoryRetrieveResponse) Reset()
func (*HistoryRetrieveResponse) String ¶
func (x *HistoryRetrieveResponse) String() string
type HistoryRetrieveResponseChat ¶
type HistoryRetrieveResponseChat struct { ChatId string `protobuf:"bytes,1,opt,name=chatId,proto3" json:"chatId,omitempty"` Messages []*HistoryRetrieveResponseChatMsg `protobuf:"bytes,5,rep,name=messages,proto3" json:"messages,omitempty"` // contains filtered or unexported fields }
func (*HistoryRetrieveResponseChat) Descriptor
deprecated
func (*HistoryRetrieveResponseChat) Descriptor() ([]byte, []int)
Deprecated: Use HistoryRetrieveResponseChat.ProtoReflect.Descriptor instead.
func (*HistoryRetrieveResponseChat) GetChatId ¶
func (x *HistoryRetrieveResponseChat) GetChatId() string
func (*HistoryRetrieveResponseChat) GetMessages ¶
func (x *HistoryRetrieveResponseChat) GetMessages() []*HistoryRetrieveResponseChatMsg
func (*HistoryRetrieveResponseChat) ProtoMessage ¶
func (*HistoryRetrieveResponseChat) ProtoMessage()
func (*HistoryRetrieveResponseChat) ProtoReflect ¶
func (x *HistoryRetrieveResponseChat) ProtoReflect() protoreflect.Message
func (*HistoryRetrieveResponseChat) Reset ¶
func (x *HistoryRetrieveResponseChat) Reset()
func (*HistoryRetrieveResponseChat) String ¶
func (x *HistoryRetrieveResponseChat) String() string
type HistoryRetrieveResponseChatMsg ¶
type HistoryRetrieveResponseChatMsg struct { Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"` Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // contains filtered or unexported fields }
func (*HistoryRetrieveResponseChatMsg) Descriptor
deprecated
func (*HistoryRetrieveResponseChatMsg) Descriptor() ([]byte, []int)
Deprecated: Use HistoryRetrieveResponseChatMsg.ProtoReflect.Descriptor instead.
func (*HistoryRetrieveResponseChatMsg) GetAuthor ¶
func (x *HistoryRetrieveResponseChatMsg) GetAuthor() string
func (*HistoryRetrieveResponseChatMsg) GetContent ¶
func (x *HistoryRetrieveResponseChatMsg) GetContent() string
func (*HistoryRetrieveResponseChatMsg) GetTimestamp ¶
func (x *HistoryRetrieveResponseChatMsg) GetTimestamp() int64
func (*HistoryRetrieveResponseChatMsg) ProtoMessage ¶
func (*HistoryRetrieveResponseChatMsg) ProtoMessage()
func (*HistoryRetrieveResponseChatMsg) ProtoReflect ¶
func (x *HistoryRetrieveResponseChatMsg) ProtoReflect() protoreflect.Message
func (*HistoryRetrieveResponseChatMsg) Reset ¶
func (x *HistoryRetrieveResponseChatMsg) Reset()
func (*HistoryRetrieveResponseChatMsg) String ¶
func (x *HistoryRetrieveResponseChatMsg) String() string
type MessageRequest ¶
type MessageRequest struct { ChatId string `protobuf:"bytes,1,opt,name=chatId,proto3" json:"chatId,omitempty"` Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
func (*MessageRequest) Descriptor
deprecated
func (*MessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use MessageRequest.ProtoReflect.Descriptor instead.
func (*MessageRequest) GetChatId ¶
func (x *MessageRequest) GetChatId() string
func (*MessageRequest) GetContent ¶
func (x *MessageRequest) GetContent() string
func (*MessageRequest) ProtoMessage ¶
func (*MessageRequest) ProtoMessage()
func (*MessageRequest) ProtoReflect ¶
func (x *MessageRequest) ProtoReflect() protoreflect.Message
func (*MessageRequest) Reset ¶
func (x *MessageRequest) Reset()
func (*MessageRequest) String ¶
func (x *MessageRequest) String() string
type MessageResponse ¶
type MessageResponse struct { Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
func (*MessageResponse) Descriptor
deprecated
func (*MessageResponse) Descriptor() ([]byte, []int)
Deprecated: Use MessageResponse.ProtoReflect.Descriptor instead.
func (*MessageResponse) GetAuthor ¶
func (x *MessageResponse) GetAuthor() string
func (*MessageResponse) GetContent ¶
func (x *MessageResponse) GetContent() string
func (*MessageResponse) ProtoMessage ¶
func (*MessageResponse) ProtoMessage()
func (*MessageResponse) ProtoReflect ¶
func (x *MessageResponse) ProtoReflect() protoreflect.Message
func (*MessageResponse) Reset ¶
func (x *MessageResponse) Reset()
func (*MessageResponse) String ¶
func (x *MessageResponse) String() string
type UnimplementedChatServer ¶
type UnimplementedChatServer struct { }
UnimplementedChatServer must be embedded to have forward compatible implementations.
func (UnimplementedChatServer) CreateChat ¶
func (UnimplementedChatServer) CreateChat(context.Context, *ChatRequest) (*ChatResponse, error)
func (UnimplementedChatServer) RetrieveHistory ¶
func (UnimplementedChatServer) RetrieveHistory(*HistoryRetrieveRequest, Chat_RetrieveHistoryServer) error
func (UnimplementedChatServer) SendMessage ¶
func (UnimplementedChatServer) SendMessage(context.Context, *MessageRequest) (*MessageResponse, error)
func (UnimplementedChatServer) SendMessageStream ¶
func (UnimplementedChatServer) SendMessageStream(*MessageRequest, Chat_SendMessageStreamServer) error
type UnsafeChatServer ¶
type UnsafeChatServer interface {
// contains filtered or unexported methods
}
UnsafeChatServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatServer will result in compilation errors.