protobuf definitions for hyper-real-time chat

change get fields to optional

Changed files
+66 -72
gen
+19 -15
gen/go/lrc.pb.go
··· 697 697 698 698 type Set struct { 699 699 state protoimpl.MessageState `protogen:"open.v1"` 700 - Nick string `protobuf:"bytes,1,opt,name=nick,proto3" json:"nick,omitempty"` 701 - ExternalID string `protobuf:"bytes,2,opt,name=externalID,proto3" json:"externalID,omitempty"` 702 - Color uint32 `protobuf:"varint,3,opt,name=color,proto3" json:"color,omitempty"` 700 + Nick *string `protobuf:"bytes,1,opt,name=nick,proto3,oneof" json:"nick,omitempty"` 701 + ExternalID *string `protobuf:"bytes,2,opt,name=externalID,proto3,oneof" json:"externalID,omitempty"` 702 + Color *uint32 `protobuf:"varint,3,opt,name=color,proto3,oneof" json:"color,omitempty"` 703 703 unknownFields protoimpl.UnknownFields 704 704 sizeCache protoimpl.SizeCache 705 705 } ··· 735 735 } 736 736 737 737 func (x *Set) GetNick() string { 738 - if x != nil { 739 - return x.Nick 738 + if x != nil && x.Nick != nil { 739 + return *x.Nick 740 740 } 741 741 return "" 742 742 } 743 743 744 744 func (x *Set) GetExternalID() string { 745 - if x != nil { 746 - return x.ExternalID 745 + if x != nil && x.ExternalID != nil { 746 + return *x.ExternalID 747 747 } 748 748 return "" 749 749 } 750 750 751 751 func (x *Set) GetColor() uint32 { 752 - if x != nil { 753 - return x.Color 752 + if x != nil && x.Color != nil { 753 + return *x.Color 754 754 } 755 755 return 0 756 756 } ··· 1104 1104 "\x04Mute\x12\x0e\n" + 1105 1105 "\x02id\x18\x01 \x01(\rR\x02id\"\x18\n" + 1106 1106 "\x06Unmute\x12\x0e\n" + 1107 - "\x02id\x18\x01 \x01(\rR\x02id\"O\n" + 1108 - "\x03Set\x12\x12\n" + 1109 - "\x04nick\x18\x01 \x01(\tR\x04nick\x12\x1e\n" + 1107 + "\x02id\x18\x01 \x01(\rR\x02id\"\x80\x01\n" + 1108 + "\x03Set\x12\x17\n" + 1109 + "\x04nick\x18\x01 \x01(\tH\x00R\x04nick\x88\x01\x01\x12#\n" + 1110 1110 "\n" + 1111 - "externalID\x18\x02 \x01(\tR\n" + 1112 - "externalID\x12\x14\n" + 1113 - "\x05color\x18\x03 \x01(\rR\x05color\"9\n" + 1111 + "externalID\x18\x02 \x01(\tH\x01R\n" + 1112 + "externalID\x88\x01\x01\x12\x19\n" + 1113 + "\x05color\x18\x03 \x01(\rH\x02R\x05color\x88\x01\x01B\a\n" + 1114 + "\x05_nickB\r\n" + 1115 + "\v_externalIDB\b\n" + 1116 + "\x06_color\"9\n" + 1114 1117 "\x03Get\x12\x14\n" + 1115 1118 "\x05topic\x18\x01 \x01(\tR\x05topic\x12\x1c\n" + 1116 1119 "\tconnected\x18\x02 \x01(\rR\tconnected\">\n" + ··· 1214 1217 (*Event_Ban)(nil), 1215 1218 (*Event_Unban)(nil), 1216 1219 } 1220 + file_lrc_proto_msgTypes[9].OneofWrappers = []any{} 1217 1221 type x struct{} 1218 1222 out := protoimpl.TypeBuilder{ 1219 1223 File: protoimpl.DescBuilder{
+47 -57
lrc.proto
··· 3 3 option go_package = "github.com/rachel-mp4/lrcproto/gen/go/lrcpb;lrcpb"; 4 4 5 5 message Event { 6 - oneof msg { 7 - Ping ping = 1; 8 - Pong pong = 2; 9 - Init init = 3; 10 - Pub pub = 4; 11 - Insert insert = 5; 12 - Delete delete = 6; 13 - Mute mute = 7; 14 - Unmute unmute = 8; 15 - Set set = 9; 16 - Get get = 10; 17 - Kick kick = 11; 18 - Hug hug = 12; 19 - Ban ban = 13; 20 - Unban unban = 14; 21 - } 6 + oneof msg { 7 + Ping ping = 1; 8 + Pong pong = 2; 9 + Init init = 3; 10 + Pub pub = 4; 11 + Insert insert = 5; 12 + Delete delete = 6; 13 + Mute mute = 7; 14 + Unmute unmute = 8; 15 + Set set = 9; 16 + Get get = 10; 17 + Kick kick = 11; 18 + Hug hug = 12; 19 + Ban ban = 13; 20 + Unban unban = 14; 21 + } 22 22 } 23 23 24 - message Ping { 25 - } 24 + message Ping {} 26 25 27 - message Pong { 28 - } 26 + message Pong {} 29 27 30 28 message Init { 31 - uint32 id = 1; 32 - string nick = 2; 33 - string externalID = 3; 34 - uint32 color = 4; 35 - bool echoed = 5; 29 + uint32 id = 1; 30 + string nick = 2; 31 + string externalID = 3; 32 + uint32 color = 4; 33 + bool echoed = 5; 36 34 } 37 35 38 - message Pub { 39 - uint32 id = 1; 40 - } 36 + message Pub { uint32 id = 1; } 41 37 42 38 message Insert { 43 - uint32 id = 1; 44 - string body = 2; 45 - uint32 byteIndex = 3; 39 + uint32 id = 1; 40 + string body = 2; 41 + uint32 byteIndex = 3; 46 42 } 47 43 48 44 message Delete { 49 - uint32 id = 1; 50 - uint32 byteStart = 2; 51 - uint32 byteEnd = 3; 45 + uint32 id = 1; 46 + uint32 byteStart = 2; 47 + uint32 byteEnd = 3; 52 48 } 53 49 54 - message Mute { 55 - uint32 id = 1; 56 - } 50 + message Mute { uint32 id = 1; } 57 51 58 - message Unmute { 59 - uint32 id = 1; 60 - } 52 + message Unmute { uint32 id = 1; } 61 53 62 54 message Set { 63 - string nick = 1; 64 - string externalID = 2; 65 - uint32 color = 3; 55 + optional string nick = 1; 56 + optional string externalID = 2; 57 + optional uint32 color = 3; 66 58 } 67 59 68 60 message Get { 69 - string topic = 1; 70 - uint32 connected = 2; 61 + string topic = 1; 62 + uint32 connected = 2; 71 63 } 72 64 73 65 message Sudo { 74 - string externalID = 1; 75 - string secret = 2; 66 + string externalID = 1; 67 + string secret = 2; 76 68 } 77 69 78 70 message Kick { 79 - Sudo privileges = 1; 80 - uint32 id = 2; 71 + Sudo privileges = 1; 72 + uint32 id = 2; 81 73 } 82 74 83 - message Hug { 84 - uint32 id = 1; 85 - } 75 + message Hug { uint32 id = 1; } 86 76 87 77 message Ban { 88 - Sudo privileges = 1; 89 - uint32 id = 2; 78 + Sudo privileges = 1; 79 + uint32 id = 2; 90 80 } 91 81 92 82 message Unban { 93 - Sudo privileges = 1; 94 - uint32 id = 2; 95 - } 83 + Sudo privileges = 1; 84 + uint32 id = 2; 85 + }