diff --git a/modules/chat/api_send.go b/modules/chat/api_send.go index 347a6092b..ca64ecd0f 100644 --- a/modules/chat/api_send.go +++ b/modules/chat/api_send.go @@ -32,19 +32,20 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code } msg = &pb.DBChat{ - Id: primitive.NewObjectID().Hex(), - Channel: req.Channel, - Suid: session.GetUserId(), - Slv: req.Ulv, - Uname: req.Uname, - Avatar: req.Avatar, - Stag: session.GetServiecTag(), - Ctype: req.Ctype, - Content: req.Content, - Ctime: time.Now().Unix(), - AppendInt: req.AppendInt, - AppendStr: req.AppendStr, - AppendBool: req.AppendBool, + Id: primitive.NewObjectID().Hex(), + Channel: req.Channel, + Suid: session.GetUserId(), + Slv: req.Ulv, + Uname: req.Uname, + Avatar: req.Avatar, + Stag: session.GetServiecTag(), + Ctype: req.Ctype, + Content: req.Content, + Ctime: time.Now().Unix(), + AppendInt: req.AppendInt, + AppendStr: req.AppendStr, + AppendBool: req.AppendBool, + AppendBytes: req.AppendBytes, } if max, err = this.module.configure.GetChannelRecordMax(); err != nil { code = pb.ErrorCode_ConfigNoFound diff --git a/pb/chat_db.pb.go b/pb/chat_db.pb.go index d76fda2d5..7d01192b9 100644 --- a/pb/chat_db.pb.go +++ b/pb/chat_db.pb.go @@ -136,22 +136,23 @@ type DBChat struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID - Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 - Ctype ChatType `protobuf:"varint,3,opt,name=ctype,proto3,enum=ChatType" json:"ctype"` //消息类型 - Suid string `protobuf:"bytes,4,opt,name=suid,proto3" json:"suid"` //发送用户id - Slv int32 `protobuf:"varint,5,opt,name=slv,proto3" json:"slv"` //发送者等级 - Ruid string `protobuf:"bytes,6,opt,name=ruid,proto3" json:"ruid"` //接收用户id channel == Private 有效 - ChannelId int32 `protobuf:"varint,7,opt,name=channelId,proto3" json:"channelId"` //跨服频道 频道Id - UnionId string `protobuf:"bytes,8,opt,name=unionId,proto3" json:"unionId"` //工会id - Stag string `protobuf:"bytes,9,opt,name=stag,proto3" json:"stag"` //区服id - Avatar string `protobuf:"bytes,10,opt,name=avatar,proto3" json:"avatar"` //用户头像 - Uname string `protobuf:"bytes,11,opt,name=uname,proto3" json:"uname"` //用户名 - Content string `protobuf:"bytes,12,opt,name=content,proto3" json:"content"` //内容 - Ctime int64 `protobuf:"varint,13,opt,name=ctime,proto3" json:"ctime"` //创建时间 - AppendInt int64 `protobuf:"varint,14,opt,name=appendInt,proto3" json:"appendInt" bson:"appendInt"` //聊天附加数据 - AppendStr string `protobuf:"bytes,15,opt,name=appendStr,proto3" json:"appendStr" bson:"appendStr"` //聊天附加数据 - AppendBool string `protobuf:"bytes,16,opt,name=appendBool,proto3" json:"appendBool" bson:"appendBool"` //聊天附加数据 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 + Ctype ChatType `protobuf:"varint,3,opt,name=ctype,proto3,enum=ChatType" json:"ctype"` //消息类型 + Suid string `protobuf:"bytes,4,opt,name=suid,proto3" json:"suid"` //发送用户id + Slv int32 `protobuf:"varint,5,opt,name=slv,proto3" json:"slv"` //发送者等级 + Ruid string `protobuf:"bytes,6,opt,name=ruid,proto3" json:"ruid"` //接收用户id channel == Private 有效 + ChannelId int32 `protobuf:"varint,7,opt,name=channelId,proto3" json:"channelId"` //跨服频道 频道Id + UnionId string `protobuf:"bytes,8,opt,name=unionId,proto3" json:"unionId"` //工会id + Stag string `protobuf:"bytes,9,opt,name=stag,proto3" json:"stag"` //区服id + Avatar string `protobuf:"bytes,10,opt,name=avatar,proto3" json:"avatar"` //用户头像 + Uname string `protobuf:"bytes,11,opt,name=uname,proto3" json:"uname"` //用户名 + Content string `protobuf:"bytes,12,opt,name=content,proto3" json:"content"` //内容 + Ctime int64 `protobuf:"varint,13,opt,name=ctime,proto3" json:"ctime"` //创建时间 + AppendInt int64 `protobuf:"varint,14,opt,name=appendInt,proto3" json:"appendInt" bson:"appendInt"` //聊天附加数据 + AppendStr string `protobuf:"bytes,15,opt,name=appendStr,proto3" json:"appendStr" bson:"appendStr"` //聊天附加数据 + AppendBool string `protobuf:"bytes,16,opt,name=appendBool,proto3" json:"appendBool" bson:"appendBool"` //聊天附加数据 + AppendBytes []byte `protobuf:"bytes,17,opt,name=appendBytes,proto3" json:"appendBytes" bson:"appendInt"` //聊天附加数据 } func (x *DBChat) Reset() { @@ -298,11 +299,18 @@ func (x *DBChat) GetAppendBool() string { return "" } +func (x *DBChat) GetAppendBytes() []byte { + if x != nil { + return x.AppendBytes + } + return nil +} + var File_chat_chat_db_proto protoreflect.FileDescriptor var file_chat_chat_db_proto_rawDesc = []byte{ 0x0a, 0x12, 0x63, 0x68, 0x61, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa1, 0x03, 0x0a, 0x06, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x12, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x03, 0x0a, 0x06, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, @@ -328,18 +336,20 @@ var file_chat_chat_db_proto_rawDesc = []byte{ 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, - 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x2a, 0x4d, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74, - 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f, 0x72, 0x6c, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x72, - 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x10, 0x04, 0x2a, 0x53, 0x0a, 0x08, 0x43, 0x68, 0x61, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x10, 0x00, 0x12, 0x0f, 0x0a, - 0x0b, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x10, 0x01, 0x12, 0x09, - 0x0a, 0x05, 0x53, 0x68, 0x61, 0x72, 0x65, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x48, 0x65, 0x72, - 0x6f, 0x53, 0x68, 0x61, 0x72, 0x65, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x71, 0x75, 0x69, - 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x68, 0x61, 0x72, 0x65, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x65, + 0x6e, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x61, + 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x2a, 0x4d, 0x0a, 0x0b, 0x43, 0x68, + 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f, 0x72, + 0x6c, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, + 0x0b, 0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, + 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, + 0x06, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x10, 0x04, 0x2a, 0x53, 0x0a, 0x08, 0x43, 0x68, 0x61, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x10, 0x00, 0x12, + 0x0f, 0x0a, 0x0b, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x10, 0x01, + 0x12, 0x09, 0x0a, 0x05, 0x53, 0x68, 0x61, 0x72, 0x65, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x48, + 0x65, 0x72, 0x6f, 0x53, 0x68, 0x61, 0x72, 0x65, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x71, + 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x68, 0x61, 0x72, 0x65, 0x10, 0x04, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/chat_msg.pb.go b/pb/chat_msg.pb.go index 3cbd98adf..8f58fa66a 100644 --- a/pb/chat_msg.pb.go +++ b/pb/chat_msg.pb.go @@ -473,16 +473,17 @@ type ChatSendReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像 - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名 - Ulv int32 `protobuf:"varint,3,opt,name=ulv,proto3" json:"ulv"` //用户等级 - Channel ChatChannel `protobuf:"varint,4,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 - TargetId string `protobuf:"bytes,5,opt,name=targetId,proto3" json:"targetId"` //目标用户id - Ctype ChatType `protobuf:"varint,6,opt,name=ctype,proto3,enum=ChatType" json:"ctype"` //消息类型 - Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content"` //内容 - AppendInt int64 `protobuf:"varint,8,opt,name=appendInt,proto3" json:"appendInt" bson:"appendInt"` //聊天附加数据 - AppendStr string `protobuf:"bytes,9,opt,name=appendStr,proto3" json:"appendStr" bson:"appendStr"` //聊天附加数据 - AppendBool string `protobuf:"bytes,10,opt,name=appendBool,proto3" json:"appendBool" bson:"appendBool"` //聊天附加数据 + Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像 + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名 + Ulv int32 `protobuf:"varint,3,opt,name=ulv,proto3" json:"ulv"` //用户等级 + Channel ChatChannel `protobuf:"varint,4,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 + TargetId string `protobuf:"bytes,5,opt,name=targetId,proto3" json:"targetId"` //目标用户id + Ctype ChatType `protobuf:"varint,6,opt,name=ctype,proto3,enum=ChatType" json:"ctype"` //消息类型 + Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content"` //内容 + AppendInt int64 `protobuf:"varint,8,opt,name=appendInt,proto3" json:"appendInt" bson:"appendInt"` //聊天附加数据 + AppendStr string `protobuf:"bytes,9,opt,name=appendStr,proto3" json:"appendStr" bson:"appendStr"` //聊天附加数据 + AppendBool string `protobuf:"bytes,10,opt,name=appendBool,proto3" json:"appendBool" bson:"appendBool"` //聊天附加数据 + AppendBytes []byte `protobuf:"bytes,11,opt,name=appendBytes,proto3" json:"appendBytes" bson:"appendInt"` //聊天附加数据 } func (x *ChatSendReq) Reset() { @@ -587,6 +588,13 @@ func (x *ChatSendReq) GetAppendBool() string { return "" } +func (x *ChatSendReq) GetAppendBytes() []byte { + if x != nil { + return x.AppendBytes + } + return nil +} + //消息发送请求 回应 type ChatSendResp struct { state protoimpl.MessageState @@ -641,16 +649,17 @@ type ChatSendCrossReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像 - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名 - Ulv int32 `protobuf:"varint,3,opt,name=ulv,proto3" json:"ulv"` //用户等级 - Channel ChatChannel `protobuf:"varint,4,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 - TargetId string `protobuf:"bytes,5,opt,name=targetId,proto3" json:"targetId"` //目标用户id - Ctype ChatType `protobuf:"varint,6,opt,name=ctype,proto3,enum=ChatType" json:"ctype"` //消息类型 - Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content"` //内容 - AppendInt int64 `protobuf:"varint,8,opt,name=appendInt,proto3" json:"appendInt" bson:"appendInt"` //聊天附加数据 - AppendStr string `protobuf:"bytes,9,opt,name=appendStr,proto3" json:"appendStr" bson:"appendStr"` //聊天附加数据 - AppendBool string `protobuf:"bytes,10,opt,name=appendBool,proto3" json:"appendBool" bson:"appendBool"` //聊天附加数据 + Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像 + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名 + Ulv int32 `protobuf:"varint,3,opt,name=ulv,proto3" json:"ulv"` //用户等级 + Channel ChatChannel `protobuf:"varint,4,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 + TargetId string `protobuf:"bytes,5,opt,name=targetId,proto3" json:"targetId"` //目标用户id + Ctype ChatType `protobuf:"varint,6,opt,name=ctype,proto3,enum=ChatType" json:"ctype"` //消息类型 + Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content"` //内容 + AppendInt int64 `protobuf:"varint,8,opt,name=appendInt,proto3" json:"appendInt" bson:"appendInt"` //聊天附加数据 + AppendStr string `protobuf:"bytes,9,opt,name=appendStr,proto3" json:"appendStr" bson:"appendStr"` //聊天附加数据 + AppendBool string `protobuf:"bytes,10,opt,name=appendBool,proto3" json:"appendBool" bson:"appendBool"` //聊天附加数据 + AppendBytes []byte `protobuf:"bytes,11,opt,name=appendBytes,proto3" json:"appendBytes" bson:"appendInt"` //聊天附加数据 } func (x *ChatSendCrossReq) Reset() { @@ -755,6 +764,13 @@ func (x *ChatSendCrossReq) GetAppendBool() string { return "" } +func (x *ChatSendCrossReq) GetAppendBytes() []byte { + if x != nil { + return x.AppendBytes + } + return nil +} + //跨服消息发送请求 回应 type ChatSendCrossResp struct { state protoimpl.MessageState @@ -842,7 +858,7 @@ var file_chat_chat_msg_proto_rawDesc = []byte{ 0x65, 0x6c, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, - 0x43, 0x68, 0x61, 0x74, 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0xa8, 0x02, 0x0a, 0x0b, + 0x43, 0x68, 0x61, 0x74, 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0xca, 0x02, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, @@ -861,32 +877,36 @@ var file_chat_chat_msg_proto_rawDesc = []byte{ 0x6e, 0x64, 0x53, 0x74, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x65, - 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x26, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x22, 0xad, - 0x02, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, - 0x75, 0x6c, 0x76, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x12, 0x1e, - 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x2b, - 0x0a, 0x11, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x61, 0x70, 0x70, + 0x65, 0x6e, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, + 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, + 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, + 0x22, 0xcf, 0x02, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x6f, + 0x73, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, + 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x75, 0x6c, 0x76, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1a, 0x0a, + 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x63, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x49, 0x6e, + 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x49, + 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x72, + 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, + 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, + 0x6f, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, + 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/sys/db/init_test.go b/sys/db/init_test.go index bbef68466..cba39da08 100644 --- a/sys/db/init_test.go +++ b/sys/db/init_test.go @@ -1,3 +1,24 @@ package db +import ( + "fmt" + "sync" + "testing" + "go.mongodb.org/mongo-driver/bson/primitive" +) + +func Test_Id(t *testing.T) { + wg := new(sync.WaitGroup) + for i := 0; i < 3; i++ { + wg.Add(1) + go func(_wg *sync.WaitGroup) { + for i := 0; i < 10; i++ { + id := primitive.NewObjectID().Hex() + fmt.Printf(id + "\n") + } + _wg.Done() + }(wg) + } + wg.Wait() +}