message

package
v0.0.0-...-8c4fe33 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

@Author: Hexiaoming 2023/2/15

Index

Constants

View Source
const (
	AppName = "message"
)

Variables

View Source
var File_apps_message_pb_message_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dousheng.message.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ChatMessageList",
			Handler:    _Service_ChatMessageList_Handler,
		},
		{
			MethodName: "ChatMessageAction",
			Handler:    _Service_ChatMessageAction_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/message/pb/message.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type ChatMessageActionRequest

type ChatMessageActionRequest struct {

	// 登录用户ID
	// @gotags: json:"from_user_id" validate:"required"
	FromUserId int64 `protobuf:"varint,1,opt,name=from_user_id,json=fromUserId,proto3" json:"from_user_id" validate:"required"`
	// 对方用户ID
	// @gotags: json:"to_user_id" validate:"required"
	ToUserId int64 `protobuf:"varint,2,opt,name=to_user_id,json=toUserId,proto3" json:"to_user_id" validate:"required"`
	// 1-发送消息
	// @gotags: json:"action_type" validate:"required"
	ActionType int32 `protobuf:"varint,3,opt,name=action_type,json=actionType,proto3" json:"action_type" validate:"required"`
	// 消息内容
	// @gotags: json:"content" validate:"required"
	Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content" validate:"required"`
	// contains filtered or unexported fields
}

发送消息 的接口请求 model

func NewChatMessageActionRequest

func NewChatMessageActionRequest() *ChatMessageActionRequest

func (*ChatMessageActionRequest) Descriptor deprecated

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

Deprecated: Use ChatMessageActionRequest.ProtoReflect.Descriptor instead.

func (*ChatMessageActionRequest) GetActionType

func (x *ChatMessageActionRequest) GetActionType() int32

func (*ChatMessageActionRequest) GetContent

func (x *ChatMessageActionRequest) GetContent() string

func (*ChatMessageActionRequest) GetFromUserId

func (x *ChatMessageActionRequest) GetFromUserId() int64

func (*ChatMessageActionRequest) GetToUserId

func (x *ChatMessageActionRequest) GetToUserId() int64

func (*ChatMessageActionRequest) ProtoMessage

func (*ChatMessageActionRequest) ProtoMessage()

func (*ChatMessageActionRequest) ProtoReflect

func (x *ChatMessageActionRequest) ProtoReflect() protoreflect.Message

func (*ChatMessageActionRequest) Reset

func (x *ChatMessageActionRequest) Reset()

func (*ChatMessageActionRequest) String

func (x *ChatMessageActionRequest) String() string

func (*ChatMessageActionRequest) Validate

func (r *ChatMessageActionRequest) Validate() error

Validate 发送聊天消息 相关

type ChatMessageActionResponse

type ChatMessageActionResponse struct {

	// 可以携带一些额外属性
	// @gotags: json:"mate"
	Mate map[string]string `` /* 139-byte string literal not displayed */
	// contains filtered or unexported fields
}

发送消息 的接口响应 model

func NewChatMessageActionResponse

func NewChatMessageActionResponse() *ChatMessageActionResponse

func (*ChatMessageActionResponse) Descriptor deprecated

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

Deprecated: Use ChatMessageActionResponse.ProtoReflect.Descriptor instead.

func (*ChatMessageActionResponse) GetMate

func (x *ChatMessageActionResponse) GetMate() map[string]string

func (*ChatMessageActionResponse) ProtoMessage

func (*ChatMessageActionResponse) ProtoMessage()

func (*ChatMessageActionResponse) ProtoReflect

func (*ChatMessageActionResponse) Reset

func (x *ChatMessageActionResponse) Reset()

func (*ChatMessageActionResponse) String

func (x *ChatMessageActionResponse) String() string

type ChatMessageListRequest

type ChatMessageListRequest struct {

	// 登录用户ID
	// @gotags: json:"from_user_id" validate:"required"
	FromUserId int64 `protobuf:"varint,1,opt,name=from_user_id,json=fromUserId,proto3" json:"from_user_id" validate:"required"`
	// 对方用户ID
	// @gotags: json:"to_user_id" validate:"required"
	ToUserId int64 `protobuf:"varint,2,opt,name=to_user_id,json=toUserId,proto3" json:"to_user_id" validate:"required"`
	// 上次最新消息的时间
	// @gotags: json:"pre_msg_time"
	PreMsgTime int64 `protobuf:"varint,3,opt,name=pre_msg_time,json=preMsgTime,proto3" json:"pre_msg_time"`
	// contains filtered or unexported fields
}

获取聊天记录消息列表 的接口请求 model

func NewChatMessageListRequest

func NewChatMessageListRequest() *ChatMessageListRequest

func (*ChatMessageListRequest) Descriptor deprecated

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

Deprecated: Use ChatMessageListRequest.ProtoReflect.Descriptor instead.

func (*ChatMessageListRequest) GetFromUserId

func (x *ChatMessageListRequest) GetFromUserId() int64

func (*ChatMessageListRequest) GetPreMsgTime

func (x *ChatMessageListRequest) GetPreMsgTime() int64

func (*ChatMessageListRequest) GetToUserId

func (x *ChatMessageListRequest) GetToUserId() int64

func (*ChatMessageListRequest) ProtoMessage

func (*ChatMessageListRequest) ProtoMessage()

func (*ChatMessageListRequest) ProtoReflect

func (x *ChatMessageListRequest) ProtoReflect() protoreflect.Message

func (*ChatMessageListRequest) Reset

func (x *ChatMessageListRequest) Reset()

func (*ChatMessageListRequest) String

func (x *ChatMessageListRequest) String() string

func (*ChatMessageListRequest) Validate

func (r *ChatMessageListRequest) Validate() error

type ChatMessageListResponse

type ChatMessageListResponse struct {

	// 关注列表用户信息
	// @gotags: json:"message_list"
	MessageList []*Message `protobuf:"bytes,1,rep,name=message_list,json=messageList,proto3" json:"message_list"`
	// contains filtered or unexported fields
}

获取聊天记录消息列表 的接口响应 model

func NewChatMessageListResponse

func NewChatMessageListResponse() *ChatMessageListResponse

func (*ChatMessageListResponse) Descriptor deprecated

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

Deprecated: Use ChatMessageListResponse.ProtoReflect.Descriptor instead.

func (*ChatMessageListResponse) GetMessageList

func (x *ChatMessageListResponse) GetMessageList() []*Message

func (*ChatMessageListResponse) ProtoMessage

func (*ChatMessageListResponse) ProtoMessage()

func (*ChatMessageListResponse) ProtoReflect

func (x *ChatMessageListResponse) ProtoReflect() protoreflect.Message

func (*ChatMessageListResponse) Reset

func (x *ChatMessageListResponse) Reset()

func (*ChatMessageListResponse) String

func (x *ChatMessageListResponse) String() string

type Message

type Message struct {

	// 消息id
	// @gotags: json:"id"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
	// 该消息接收者id
	// @gotags: json:"to_user_id"
	ToUserId int64 `protobuf:"varint,2,opt,name=to_user_id,json=toUserId,proto3" json:"to_user_id"`
	// 该消息发送者id
	// @gotags: json:"from_user_id"
	FromUserId int64 `protobuf:"varint,3,opt,name=from_user_id,json=fromUserId,proto3" json:"from_user_id"`
	// 消息内容
	// @gotags: json:"content"
	Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content"`
	// 消息创建时间
	// @gotags: json:"create_time"
	CreateTime int64 `protobuf:"varint,5,opt,name=create_time,json=createTime,proto3" json:"create_time"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetContent

func (x *Message) GetContent() string

func (*Message) GetCreateTime

func (x *Message) GetCreateTime() int64

func (*Message) GetFromUserId

func (x *Message) GetFromUserId() int64

func (*Message) GetId

func (x *Message) GetId() int64

func (*Message) GetToUserId

func (x *Message) GetToUserId() int64

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type MessagePo

type MessagePo struct {

	// 消息id
	// @gotags: json:"id" gorm:"id"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id" gorm:"id"`
	// 该消息接收者id
	// @gotags: json:"to_user_id" gorm:"to_user_id"
	ToUserId int64 `protobuf:"varint,2,opt,name=to_user_id,json=toUserId,proto3" json:"to_user_id" gorm:"to_user_id"`
	// 该消息发送者id
	// @gotags: json:"from_user_id" gorm:"from_user_id"
	FromUserId int64 `protobuf:"varint,3,opt,name=from_user_id,json=fromUserId,proto3" json:"from_user_id" gorm:"from_user_id"`
	// 消息内容
	// @gotags: json:"content" gorm:"content"
	Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content" gorm:"content"`
	// 消息创建时间
	// @gotags: json:"created_at" gorm:"created_at"
	CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at" gorm:"created_at"`
	// contains filtered or unexported fields
}

聊天记录表:与数据库对应的PO对象

func NewMessagePo

func NewMessagePo(req *ChatMessageActionRequest) *MessagePo

func (*MessagePo) Descriptor deprecated

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

Deprecated: Use MessagePo.ProtoReflect.Descriptor instead.

func (*MessagePo) GetContent

func (x *MessagePo) GetContent() string

func (*MessagePo) GetCreatedAt

func (x *MessagePo) GetCreatedAt() int64

func (*MessagePo) GetFromUserId

func (x *MessagePo) GetFromUserId() int64

func (*MessagePo) GetId

func (x *MessagePo) GetId() int64

func (*MessagePo) GetToUserId

func (x *MessagePo) GetToUserId() int64

func (*MessagePo) ProtoMessage

func (*MessagePo) ProtoMessage()

func (*MessagePo) ProtoReflect

func (x *MessagePo) ProtoReflect() protoreflect.Message

func (*MessagePo) Reset

func (x *MessagePo) Reset()

func (*MessagePo) String

func (x *MessagePo) String() string

func (*MessagePo) TableName

func (*MessagePo) TableName() string

TableName 指明表名 -> gorm 参数映射

type ServiceClient

type ServiceClient interface {
	// 获取消息列表
	ChatMessageList(ctx context.Context, in *ChatMessageListRequest, opts ...grpc.CallOption) (*ChatMessageListResponse, error)
	// 消息操作
	ChatMessageAction(ctx context.Context, in *ChatMessageActionRequest, opts ...grpc.CallOption) (*ChatMessageActionResponse, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// 获取消息列表
	ChatMessageList(context.Context, *ChatMessageListRequest) (*ChatMessageListResponse, error)
	// 消息操作
	ChatMessageAction(context.Context, *ChatMessageActionRequest) (*ChatMessageActionResponse, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) ChatMessageList

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

Directories

Path Synopsis
@Author: Hexiaoming 2023/2/7
@Author: Hexiaoming 2023/2/7

Jump to

Keyboard shortcuts

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