Store messages with DbMessage Type
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc
2024-02-29 21:03:15 +01:00
parent 4b3d7548bd
commit f20681adab
7 changed files with 244 additions and 38 deletions

View File

@ -1457,6 +1457,125 @@ func (x *Location) GetAltitude() int32 {
return 0
}
type DbMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Outbound bool `protobuf:"varint,1,opt,name=outbound,proto3" json:"outbound,omitempty"` // direction of the message
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // text data
Status *ConversationStatus `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"`
Contact *ContactCard `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"`
Group *Group `protobuf:"bytes,6,opt,name=group,proto3" json:"group,omitempty"`
FilePaths []string `protobuf:"bytes,7,rep,name=file_paths,json=filePaths,proto3" json:"file_paths,omitempty"`
CurrentLocation *Location `protobuf:"bytes,8,opt,name=current_location,json=currentLocation,proto3" json:"current_location,omitempty"`
Appdata []byte `protobuf:"bytes,9,opt,name=appdata,proto3" json:"appdata,omitempty"`
Invitation *Invitation `protobuf:"bytes,10,opt,name=invitation,proto3" json:"invitation,omitempty"`
}
func (x *DbMessage) Reset() {
*x = DbMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_messages_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DbMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DbMessage) ProtoMessage() {}
func (x *DbMessage) ProtoReflect() protoreflect.Message {
mi := &file_messages_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DbMessage.ProtoReflect.Descriptor instead.
func (*DbMessage) Descriptor() ([]byte, []int) {
return file_messages_proto_rawDescGZIP(), []int{17}
}
func (x *DbMessage) GetOutbound() bool {
if x != nil {
return x.Outbound
}
return false
}
func (x *DbMessage) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *DbMessage) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
func (x *DbMessage) GetStatus() *ConversationStatus {
if x != nil {
return x.Status
}
return nil
}
func (x *DbMessage) GetContact() *ContactCard {
if x != nil {
return x.Contact
}
return nil
}
func (x *DbMessage) GetGroup() *Group {
if x != nil {
return x.Group
}
return nil
}
func (x *DbMessage) GetFilePaths() []string {
if x != nil {
return x.FilePaths
}
return nil
}
func (x *DbMessage) GetCurrentLocation() *Location {
if x != nil {
return x.CurrentLocation
}
return nil
}
func (x *DbMessage) GetAppdata() []byte {
if x != nil {
return x.Appdata
}
return nil
}
func (x *DbMessage) GetInvitation() *Invitation {
if x != nil {
return x.Invitation
}
return nil
}
var File_messages_proto protoreflect.FileDescriptor
var file_messages_proto_rawDesc = []byte{
@ -1684,10 +1803,34 @@ var file_messages_proto_rawDesc = []byte{
0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02,
0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61,
0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x61,
0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x42, 0x21, 0x5a, 0x1f, 0x66, 0x6f, 0x72, 0x67, 0x65,
0x2e, 0x72, 0x65, 0x64, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x79, 0x76,
0x65, 0x73, 0x2f, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x22, 0x86, 0x03, 0x0a, 0x09, 0x44, 0x62, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e,
0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6f, 0x77,
0x6c, 0x69, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e,
0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63,
0x74, 0x43, 0x61, 0x72, 0x64, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x24,
0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67,
0x72, 0x6f, 0x75, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74,
0x68, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61,
0x74, 0x68, 0x73, 0x12, 0x3c, 0x0a, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x6c,
0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x0f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x64, 0x61, 0x74, 0x61, 0x18, 0x09, 0x20, 0x01,
0x28, 0x0c, 0x52, 0x07, 0x61, 0x70, 0x70, 0x64, 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x0a, 0x69,
0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x13, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x42, 0x21, 0x5a, 0x1f, 0x66, 0x6f, 0x72, 0x67, 0x65, 0x2e, 0x72, 0x65, 0x64, 0x72, 0x6f, 0x6f,
0x6d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x79, 0x76, 0x65, 0x73, 0x2f, 0x6d, 0x65, 0x6f, 0x77,
0x6c, 0x69, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1702,7 +1845,7 @@ func file_messages_proto_rawDescGZIP() []byte {
return file_messages_proto_rawDescData
}
var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_messages_proto_goTypes = []interface{}{
(*PackedServerMessage)(nil), // 0: meowlib.PackedServerMessage
(*Invitation)(nil), // 1: meowlib.Invitation
@ -1721,6 +1864,7 @@ var file_messages_proto_goTypes = []interface{}{
(*UserMessage)(nil), // 14: meowlib.UserMessage
(*File)(nil), // 15: meowlib.File
(*Location)(nil), // 16: meowlib.Location
(*DbMessage)(nil), // 17: meowlib.DbMessage
}
var file_messages_proto_depIdxs = []int32{
10, // 0: meowlib.Meet.contact_card:type_name -> meowlib.ContactCard
@ -1746,11 +1890,16 @@ var file_messages_proto_depIdxs = []int32{
15, // 20: meowlib.UserMessage.files:type_name -> meowlib.File
16, // 21: meowlib.UserMessage.currentLocation:type_name -> meowlib.Location
1, // 22: meowlib.UserMessage.invitation:type_name -> meowlib.Invitation
23, // [23:23] is the sub-list for method output_type
23, // [23:23] is the sub-list for method input_type
23, // [23:23] is the sub-list for extension type_name
23, // [23:23] is the sub-list for extension extendee
0, // [0:23] is the sub-list for field type_name
12, // 23: meowlib.DbMessage.status:type_name -> meowlib.ConversationStatus
10, // 24: meowlib.DbMessage.contact:type_name -> meowlib.ContactCard
13, // 25: meowlib.DbMessage.group:type_name -> meowlib.Group
16, // 26: meowlib.DbMessage.current_location:type_name -> meowlib.Location
1, // 27: meowlib.DbMessage.invitation:type_name -> meowlib.Invitation
28, // [28:28] is the sub-list for method output_type
28, // [28:28] is the sub-list for method input_type
28, // [28:28] is the sub-list for extension type_name
28, // [28:28] is the sub-list for extension extendee
0, // [0:28] is the sub-list for field type_name
}
func init() { file_messages_proto_init() }
@ -1963,6 +2112,18 @@ func file_messages_proto_init() {
return nil
}
}
file_messages_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DbMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -1970,7 +2131,7 @@ func file_messages_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_messages_proto_rawDesc,
NumEnums: 0,
NumMessages: 17,
NumMessages: 18,
NumExtensions: 0,
NumServices: 0,
},