notes
This commit is contained in:
parent
874453d685
commit
7134618aa8
Notes:
Jeff Carr
2025-02-14 00:46:58 -06:00
// `autogen:go.mod` module go.wit.com/lib/protobuf/guipb go 1.22 toolchain go1.23.6 require google.golang.org/protobuf v1.36.5 // `autogen:go.sum` github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= // `autogen:table.marshal.pb.go` // Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. // This file was autogenerated with autogenpb v0.0.52-1-g4fdcc99 2025.02.12_1512 // go install go.wit.com/apps/autogenpb@latest // // define which structs (messages) you want to use in the .proto file // Then sort.pb.go and marshal.pb.go files are autogenerated // // autogenpb uses it and has an example .proto file with instructions // package guipb import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" ) // human readable JSON func (v *Tables) FormatJSON() string { return protojson.Format(v) } // marshal json func (v *Tables) MarshalJSON() ([]byte, error) { return protojson.Marshal(v) } // unmarshal json func (v *Tables) UnmarshalJSON(data []byte) error { return protojson.Unmarshal(data, v) } // apparently this isn't stable, but it's awesomely better // https://protobuf.dev/reference/go/faq/#unstable-text // it's brilliant for config files! func (v *Tables) FormatTEXT() string { v.fixUuid() return prototext.Format(v) } // unmarshalTEXT. This reads the .text config file back in after the user edits it func (v *Tables) UnmarshalTEXT(data []byte) error { return prototext.Unmarshal(data, v) } // marshal to wire. This is called winning. func (v *Tables) Marshal() ([]byte, error) { v.fixUuid() return proto.Marshal(v) } // unmarshal from wire. You have won. func (v *Tables) Unmarshal(data []byte) error { return proto.Unmarshal(data, v) } // human readable JSON func (v *Table) FormatJSON() string { return protojson.Format(v) } // marshal json func (v *Table) MarshalJSON() ([]byte, error) { return protojson.Marshal(v) } // unmarshal json func (v *Table) UnmarshalJSON(data []byte) error { return protojson.Unmarshal(data, v) } // apparently this isn't stable, but it's awesomely better // https://protobuf.dev/reference/go/faq/#unstable-text // it's brilliant for config files! func (v *Table) FormatTEXT() string { return prototext.Format(v) } // unmarshalTEXT. This reads the .text config file back in after the user edits it func (v *Table) UnmarshalTEXT(data []byte) error { return prototext.Unmarshal(data, v) } // marshal to wire. This is called winning. func (v *Table) Marshal() ([]byte, error) { return proto.Marshal(v) } // unmarshal from wire. You have won. func (v *Table) Unmarshal(data []byte) error { return proto.Unmarshal(data, v) } // `autogen:table.pb.go` // Code modified by go.wit.com/apps/autogenpb DO NOT EDIT. // // user defined Mutex locks were auto added // // autogenpb version & build time: v0.0.52-1-g4fdcc99 2025.02.12_1512 // autogenpb auto generates Sort(), Unique() and Marshal() functions // go install go.wit.com/apps/autogenpb@latest // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 // protoc v3.21.12 // source: table.proto // playing around with ideas here package guipb // autogenpb changed the package name import ( reflect "reflect" sync "sync" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" _ "google.golang.org/protobuf/types/known/timestamppb" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) type StringRow struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // Vals []string `protobuf:"bytes,2,rep,name=vals,proto3" json:"vals,omitempty"` // WidgetS []*Widget `protobuf:"bytes,3,rep,name=widgetS,proto3" json:"widgetS,omitempty"` // } func (x *StringRow) Reset() { *x = StringRow{} if protoimpl.UnsafeEnabled { mi := &file_table_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *StringRow) String() string { return protoimpl.X.MessageStringOf(x) } func (*StringRow) ProtoMessage() {} func (x *StringRow) ProtoReflect() protoreflect.Message { mi := &file_table_proto_msgTypes[0] 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 StringRow.ProtoReflect.Descriptor instead. func (*StringRow) Descriptor() ([]byte, []int) { return file_table_proto_rawDescGZIP(), []int{0} } func (x *StringRow) GetHeader() string { if x != nil { return x.Header } return "" } func (x *StringRow) GetVals() []string { if x != nil { return x.Vals } return nil } func (x *StringRow) GetWidgetS() []*Widget { if x != nil { return x.WidgetS } return nil } type IntRow struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Header *Widget `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // Widgets []*Widget `protobuf:"bytes,2,rep,name=widgets,proto3" json:"widgets,omitempty"` // } func (x *IntRow) Reset() { *x = IntRow{} if protoimpl.UnsafeEnabled { mi := &file_table_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *IntRow) String() string { return protoimpl.X.MessageStringOf(x) } func (*IntRow) ProtoMessage() {} func (x *IntRow) ProtoReflect() protoreflect.Message { mi := &file_table_proto_msgTypes[1] 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 IntRow.ProtoReflect.Descriptor instead. func (*IntRow) Descriptor() ([]byte, []int) { return file_table_proto_rawDescGZIP(), []int{1} } func (x *IntRow) GetHeader() *Widget { if x != nil { return x.Header } return nil } func (x *IntRow) GetWidgets() []*Widget { if x != nil { return x.Widgets } return nil } type TimeRow struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Header *Widget `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // Widgets []*Widget `protobuf:"bytes,2,rep,name=widgets,proto3" json:"widgets,omitempty"` // } func (x *TimeRow) Reset() { *x = TimeRow{} if protoimpl.UnsafeEnabled { mi := &file_table_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *TimeRow) String() string { return protoimpl.X.MessageStringOf(x) } func (*TimeRow) ProtoMessage() {} func (x *TimeRow) ProtoReflect() protoreflect.Message { mi := &file_table_proto_msgTypes[2] 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 TimeRow.ProtoReflect.Descriptor instead. func (*TimeRow) Descriptor() ([]byte, []int) { return file_table_proto_rawDescGZIP(), []int{2} } func (x *TimeRow) GetHeader() *Widget { if x != nil { return x.Header } return nil } func (x *TimeRow) GetWidgets() []*Widget { if x != nil { return x.Widgets } return nil } type BoolRow struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Header *Widget `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // Widgets []*Widget `protobuf:"bytes,2,rep,name=widgets,proto3" json:"widgets,omitempty"` // } func (x *BoolRow) Reset() { *x = BoolRow{} if protoimpl.UnsafeEnabled { mi := &file_table_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *BoolRow) String() string { return protoimpl.X.MessageStringOf(x) } func (*BoolRow) ProtoMessage() {} func (x *BoolRow) ProtoReflect() protoreflect.Message { mi := &file_table_proto_msgTypes[3] 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 BoolRow.ProtoReflect.Descriptor instead. func (*BoolRow) Descriptor() ([]byte, []int) { return file_table_proto_rawDescGZIP(), []int{3} } func (x *BoolRow) GetHeader() *Widget { if x != nil { return x.Header } return nil } func (x *BoolRow) GetWidgets() []*Widget { if x != nil { return x.Widgets } return nil } type Table struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Order []string `protobuf:"bytes,1,rep,name=order,proto3" json:"order,omitempty"` StringRows []*StringRow `protobuf:"bytes,2,rep,name=StringRows,proto3" json:"StringRows,omitempty"` IntRows []*IntRow `protobuf:"bytes,3,rep,name=IntRows,proto3" json:"IntRows,omitempty"` TimeRows []*TimeRow `protobuf:"bytes,4,rep,name=TimeRows,proto3" json:"TimeRows,omitempty"` BoolRows []*BoolRow `protobuf:"bytes,5,rep,name=BoolRows,proto3" json:"BoolRows,omitempty"` } func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { mi := &file_table_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Table) String() string { return protoimpl.X.MessageStringOf(x) } func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { mi := &file_table_proto_msgTypes[4] 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 Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { return file_table_proto_rawDescGZIP(), []int{4} } func (x *Table) GetOrder() []string { if x != nil { return x.Order } return nil } func (x *Table) GetStringRows() []*StringRow { if x != nil { return x.StringRows } return nil } func (x *Table) GetIntRows() []*IntRow { if x != nil { return x.IntRows } return nil } func (x *Table) GetTimeRows() []*TimeRow { if x != nil { return x.TimeRows } return nil } func (x *Table) GetBoolRows() []*BoolRow { if x != nil { return x.BoolRows } return nil } type Tables struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:c328aa62-3c4f-4d00-9244-cc44ae75ab1b` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v1` Tables []*Table `protobuf:"bytes,3,rep,name=Tables,proto3" json:"Tables,omitempty"` } func (x *Tables) Reset() { *x = Tables{} if protoimpl.UnsafeEnabled { mi := &file_table_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Tables) String() string { return protoimpl.X.MessageStringOf(x) } func (*Tables) ProtoMessage() {} func (x *Tables) ProtoReflect() protoreflect.Message { mi := &file_table_proto_msgTypes[5] 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 Tables.ProtoReflect.Descriptor instead. func (*Tables) Descriptor() ([]byte, []int) { return file_table_proto_rawDescGZIP(), []int{5} } func (x *Tables) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *Tables) GetVersion() string { if x != nil { return x.Version } return "" } func (x *Tables) GetTables() []*Table { if x != nil { return x.Tables } return nil } var File_table_proto protoreflect.FileDescriptor var file_table_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x67, 0x69, 0x74, 0x70, 0x62, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x0a, 0x09, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x77, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x27, 0x0a, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x53, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x53, 0x22, 0x58, 0x0a, 0x06, 0x49, 0x6e, 0x74, 0x52, 0x6f, 0x77, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x22, 0x59, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x6f, 0x77, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x22, 0x59, 0x0a, 0x07, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x6f, 0x77, 0x12, 0x25, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x07, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x22, 0xd0, 0x01, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x77, 0x52, 0x0a, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x27, 0x0a, 0x07, 0x49, 0x6e, 0x74, 0x52, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x6f, 0x77, 0x52, 0x07, 0x49, 0x6e, 0x74, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x6f, 0x77, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x6f, 0x77, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x6f, 0x77, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x6f, 0x77, 0x52, 0x08, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x6f, 0x77, 0x73, 0x22, 0x5c, 0x0a, 0x06, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x06, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x06, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_table_proto_rawDescOnce sync.Once file_table_proto_rawDescData = file_table_proto_rawDesc ) func file_table_proto_rawDescGZIP() []byte { file_table_proto_rawDescOnce.Do(func() { file_table_proto_rawDescData = protoimpl.X.CompressGZIP(file_table_proto_rawDescData) }) return file_table_proto_rawDescData } var file_table_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_table_proto_goTypes = []interface{}{ (*StringRow)(nil), // 0: gitpb.StringRow (*IntRow)(nil), // 1: gitpb.IntRow (*TimeRow)(nil), // 2: gitpb.TimeRow (*BoolRow)(nil), // 3: gitpb.BoolRow (*Table)(nil), // 4: gitpb.Table (*Tables)(nil), // 5: gitpb.Tables (*Widget)(nil), // 6: gitpb.Widget } var file_table_proto_depIdxs = []int32{ 6, // 0: gitpb.StringRow.widgetS:type_name -> gitpb.Widget 6, // 1: gitpb.IntRow.header:type_name -> gitpb.Widget 6, // 2: gitpb.IntRow.widgets:type_name -> gitpb.Widget 6, // 3: gitpb.TimeRow.header:type_name -> gitpb.Widget 6, // 4: gitpb.TimeRow.widgets:type_name -> gitpb.Widget 6, // 5: gitpb.BoolRow.header:type_name -> gitpb.Widget 6, // 6: gitpb.BoolRow.widgets:type_name -> gitpb.Widget 0, // 7: gitpb.Table.StringRows:type_name -> gitpb.StringRow 1, // 8: gitpb.Table.IntRows:type_name -> gitpb.IntRow 2, // 9: gitpb.Table.TimeRows:type_name -> gitpb.TimeRow 3, // 10: gitpb.Table.BoolRows:type_name -> gitpb.BoolRow 4, // 11: gitpb.Tables.Tables:type_name -> gitpb.Table 12, // [12:12] is the sub-list for method output_type 12, // [12:12] is the sub-list for method input_type 12, // [12:12] is the sub-list for extension type_name 12, // [12:12] is the sub-list for extension extendee 0, // [0:12] is the sub-list for field type_name } func init() { file_table_proto_init() } func file_table_proto_init() { if File_table_proto != nil { return } file_widget_proto_init() if !protoimpl.UnsafeEnabled { file_table_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StringRow); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_table_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IntRow); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_table_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TimeRow); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_table_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BoolRow); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_table_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Table); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_table_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Tables); 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{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_table_proto_rawDesc, NumEnums: 0, NumMessages: 6, NumExtensions: 0, NumServices: 0, }, GoTypes: file_table_proto_goTypes, DependencyIndexes: file_table_proto_depIdxs, MessageInfos: file_table_proto_msgTypes, }.Build() File_table_proto = out.File file_table_proto_rawDesc = nil file_table_proto_goTypes = nil file_table_proto_depIdxs = nil } // `autogen:table.sort.pb.go` // Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. // This file was autogenerated with autogenpb v0.0.52-1-g4fdcc99 2025.02.12_1512 // go install go.wit.com/apps/autogenpb@latest // // define which structs (messages) you want to use in the .proto file // Then sort.pb.go and marshal.pb.go files are autogenerated // // autogenpb uses it and has an example .proto file with instructions // package guipb import ( "fmt" "sync" ) // a simple global lock var tableMu sync.RWMutex func (x *Tables) fixUuid() { if x == nil { return } if x.Uuid == "c328aa62-3c4f-4d00-9244-cc44ae75ab1b" { return } x.Uuid = "c328aa62-3c4f-4d00-9244-cc44ae75ab1b" x.Version = "v1 go.wit.com/lib/protobuf/guipb" } func NewTables() *Tables { x := new(Tables) x.Uuid = "c328aa62-3c4f-4d00-9244-cc44ae75ab1b" x.Version = "v1 go.wit.com/lib/protobuf/guipb" return x } // START SORT // DEFINE THE Tables ITERATOR. // itializes a new iterator. func newTablesIterator(things []*Tables) *TablesIterator { return &TablesIterator{things: things} } type TablesIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Tables index int } func (it *TablesIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *TablesIterator) Next() *Tables { if it.things[it.index-1] == nil { fmt.Println("Next() error in TablesIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Table ITERATOR. // itializes a new iterator. func newTableIterator(things []*Table) *TableIterator { return &TableIterator{things: things} } type TableIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Table index int } func (it *TableIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *TableIterator) Next() *Table { if it.things[it.index-1] == nil { fmt.Println("Next() error in TableIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE StringRow ITERATOR. // itializes a new iterator. func newStringRowIterator(things []*StringRow) *StringRowIterator { return &StringRowIterator{things: things} } type StringRowIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*StringRow index int } func (it *StringRowIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *StringRowIterator) Next() *StringRow { if it.things[it.index-1] == nil { fmt.Println("Next() error in StringRowIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE IntRow ITERATOR. // itializes a new iterator. func newIntRowIterator(things []*IntRow) *IntRowIterator { return &IntRowIterator{things: things} } type IntRowIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*IntRow index int } func (it *IntRowIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *IntRowIterator) Next() *IntRow { if it.things[it.index-1] == nil { fmt.Println("Next() error in IntRowIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE TimeRow ITERATOR. // itializes a new iterator. func newTimeRowIterator(things []*TimeRow) *TimeRowIterator { return &TimeRowIterator{things: things} } type TimeRowIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*TimeRow index int } func (it *TimeRowIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *TimeRowIterator) Next() *TimeRow { if it.things[it.index-1] == nil { fmt.Println("Next() error in TimeRowIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE BoolRow ITERATOR. // itializes a new iterator. func newBoolRowIterator(things []*BoolRow) *BoolRowIterator { return &BoolRowIterator{things: things} } type BoolRowIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*BoolRow index int } func (it *BoolRowIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *BoolRowIterator) Next() *BoolRow { if it.things[it.index-1] == nil { fmt.Println("Next() error in BoolRowIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // safely returns a slice of pointers to the FRUIT protobufs func (x *Tables) allTables() []*Table { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*Table tmp = make([]*Table, len(x.Tables)) for i, p := range x.Tables { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *Table) allStringRows() []*StringRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*StringRow tmp = make([]*StringRow, len(x.StringRows)) for i, p := range x.StringRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *Table) allIntRows() []*IntRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*IntRow tmp = make([]*IntRow, len(x.IntRows)) for i, p := range x.IntRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *Table) allTimeRows() []*TimeRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*TimeRow tmp = make([]*TimeRow, len(x.TimeRows)) for i, p := range x.TimeRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *Table) allBoolRows() []*BoolRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*BoolRow tmp = make([]*BoolRow, len(x.BoolRows)) for i, p := range x.BoolRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the Table protobufs func (x *Tables) selectAllTables() []*Table { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each Table var tmp []*Table tmp = make([]*Table, len(x.Tables)) for i, p := range x.Tables { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the StringRow protobufs func (x *Table) selectAllStringRows() []*StringRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each StringRow var tmp []*StringRow tmp = make([]*StringRow, len(x.StringRows)) for i, p := range x.StringRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the IntRow protobufs func (x *Table) selectAllIntRows() []*IntRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each IntRow var tmp []*IntRow tmp = make([]*IntRow, len(x.IntRows)) for i, p := range x.IntRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the TimeRow protobufs func (x *Table) selectAllTimeRows() []*TimeRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each TimeRow var tmp []*TimeRow tmp = make([]*TimeRow, len(x.TimeRows)) for i, p := range x.TimeRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the BoolRow protobufs func (x *Table) selectAllBoolRows() []*BoolRow { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each BoolRow var tmp []*BoolRow tmp = make([]*BoolRow, len(x.BoolRows)) for i, p := range x.BoolRows { tmp[i] = p // Copy pointers for safe iteration } return tmp } // END SORT func (x *Tables) Len() int { x.RLock() defer x.RUnlock() return len(x.Tables) } // just a simple Append() shortcut (but still uses the mutex lock) func (x *Tables) Append(y *Table) { x.Lock() defer x.Unlock() x.Tables = append(x.Tables, y) } func (x *Tables) All() *TableIterator { TablePointers := x.selectAllTables() iterator := newTableIterator(TablePointers) return iterator } func (x *Tables) Delete(y *Table) bool { x.Lock() defer x.Unlock() for i, _ := range x.Tables { if x.Tables[i] == y { x.Tables[i] = x.Tables[len(x.Tables)-1] x.Tables = x.Tables[:len(x.Tables)-1] return true } } return false } // `autogen:widget.marshal.pb.go` // Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. // This file was autogenerated with autogenpb v0.0.52-1-g4fdcc99 2025.02.12_1512 // go install go.wit.com/apps/autogenpb@latest // // define which structs (messages) you want to use in the .proto file // Then sort.pb.go and marshal.pb.go files are autogenerated // // autogenpb uses it and has an example .proto file with instructions // package guipb // `autogen:widget.pb.go` // Code modified by go.wit.com/apps/autogenpb DO NOT EDIT. // // user defined Mutex locks were auto added // // autogenpb version & build time: v0.0.52-1-g4fdcc99 2025.02.12_1512 // autogenpb auto generates Sort(), Unique() and Marshal() functions // go install go.wit.com/apps/autogenpb@latest // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 // protoc v3.21.12 // source: widget.proto // playing around with ideas here package guipb // autogenpb changed the package name import ( reflect "reflect" sync "sync" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) type Size struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Width int64 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` } func (x *Size) Reset() { *x = Size{} if protoimpl.UnsafeEnabled { mi := &file_widget_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Size) String() string { return protoimpl.X.MessageStringOf(x) } func (*Size) ProtoMessage() {} func (x *Size) ProtoReflect() protoreflect.Message { mi := &file_widget_proto_msgTypes[0] 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 Size.ProtoReflect.Descriptor instead. func (*Size) Descriptor() ([]byte, []int) { return file_widget_proto_rawDescGZIP(), []int{0} } func (x *Size) GetWidth() int64 { if x != nil { return x.Width } return 0 } func (x *Size) GetHeight() int64 { if x != nil { return x.Height } return 0 } type Location struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields X int64 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` Y int64 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"` } func (x *Location) Reset() { *x = Location{} if protoimpl.UnsafeEnabled { mi := &file_widget_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Location) String() string { return protoimpl.X.MessageStringOf(x) } func (*Location) ProtoMessage() {} func (x *Location) ProtoReflect() protoreflect.Message { mi := &file_widget_proto_msgTypes[1] 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 Location.ProtoReflect.Descriptor instead. func (*Location) Descriptor() ([]byte, []int) { return file_widget_proto_rawDescGZIP(), []int{1} } func (x *Location) GetX() int64 { if x != nil { return x.X } return 0 } func (x *Location) GetY() int64 { if x != nil { return x.Y } return 0 } type Tree struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Parent *Widget `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` Children []*Widget `protobuf:"bytes,2,rep,name=children,proto3" json:"children,omitempty"` } func (x *Tree) Reset() { *x = Tree{} if protoimpl.UnsafeEnabled { mi := &file_widget_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Tree) String() string { return protoimpl.X.MessageStringOf(x) } func (*Tree) ProtoMessage() {} func (x *Tree) ProtoReflect() protoreflect.Message { mi := &file_widget_proto_msgTypes[2] 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 Tree.ProtoReflect.Descriptor instead. func (*Tree) Descriptor() ([]byte, []int) { return file_widget_proto_rawDescGZIP(), []int{2} } func (x *Tree) GetParent() *Widget { if x != nil { return x.Parent } return nil } func (x *Tree) GetChildren() []*Widget { if x != nil { return x.Children } return nil } type Widget struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Size *Size `protobuf:"bytes,3,opt,name=size,proto3" json:"size,omitempty"` Location *Location `protobuf:"bytes,4,opt,name=location,proto3" json:"location,omitempty"` Color string `protobuf:"bytes,5,opt,name=color,proto3" json:"color,omitempty"` TK *anypb.Any `protobuf:"bytes,6,opt,name=TK,proto3" json:"TK,omitempty"` } func (x *Widget) Reset() { *x = Widget{} if protoimpl.UnsafeEnabled { mi := &file_widget_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Widget) String() string { return protoimpl.X.MessageStringOf(x) } func (*Widget) ProtoMessage() {} func (x *Widget) ProtoReflect() protoreflect.Message { mi := &file_widget_proto_msgTypes[3] 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 Widget.ProtoReflect.Descriptor instead. func (*Widget) Descriptor() ([]byte, []int) { return file_widget_proto_rawDescGZIP(), []int{3} } func (x *Widget) GetId() int64 { if x != nil { return x.Id } return 0 } func (x *Widget) GetName() string { if x != nil { return x.Name } return "" } func (x *Widget) GetSize() *Size { if x != nil { return x.Size } return nil } func (x *Widget) GetLocation() *Location { if x != nil { return x.Location } return nil } func (x *Widget) GetColor() string { if x != nil { return x.Color } return "" } func (x *Widget) GetTK() *anypb.Any { if x != nil { return x.TK } return nil } type Widgets struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v1` Widgets []*Widget `protobuf:"bytes,3,rep,name=Widgets,proto3" json:"Widgets,omitempty"` } func (x *Widgets) Reset() { *x = Widgets{} if protoimpl.UnsafeEnabled { mi := &file_widget_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Widgets) String() string { return protoimpl.X.MessageStringOf(x) } func (*Widgets) ProtoMessage() {} func (x *Widgets) ProtoReflect() protoreflect.Message { mi := &file_widget_proto_msgTypes[4] 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 Widgets.ProtoReflect.Descriptor instead. func (*Widgets) Descriptor() ([]byte, []int) { return file_widget_proto_rawDescGZIP(), []int{4} } func (x *Widgets) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *Widgets) GetVersion() string { if x != nil { return x.Version } return "" } func (x *Widgets) GetWidgets() []*Widget { if x != nil { return x.Widgets } return nil } var File_widget_proto protoreflect.FileDescriptor var file_widget_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x77, 0x69, 0x64, 0x67, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x67, 0x69, 0x74, 0x70, 0x62, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x26, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x79, 0x22, 0x58, 0x0a, 0x04, 0x54, 0x72, 0x65, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0xb6, 0x01, 0x0a, 0x06, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x24, 0x0a, 0x02, 0x54, 0x4b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, 0x54, 0x4b, 0x22, 0x60, 0x0a, 0x07, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x62, 0x2e, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x52, 0x07, 0x57, 0x69, 0x64, 0x67, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_widget_proto_rawDescOnce sync.Once file_widget_proto_rawDescData = file_widget_proto_rawDesc ) func file_widget_proto_rawDescGZIP() []byte { file_widget_proto_rawDescOnce.Do(func() { file_widget_proto_rawDescData = protoimpl.X.CompressGZIP(file_widget_proto_rawDescData) }) return file_widget_proto_rawDescData } var file_widget_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_widget_proto_goTypes = []interface{}{ (*Size)(nil), // 0: gitpb.Size (*Location)(nil), // 1: gitpb.Location (*Tree)(nil), // 2: gitpb.Tree (*Widget)(nil), // 3: gitpb.Widget (*Widgets)(nil), // 4: gitpb.Widgets (*anypb.Any)(nil), // 5: google.protobuf.Any } var file_widget_proto_depIdxs = []int32{ 3, // 0: gitpb.Tree.parent:type_name -> gitpb.Widget 3, // 1: gitpb.Tree.children:type_name -> gitpb.Widget 0, // 2: gitpb.Widget.size:type_name -> gitpb.Size 1, // 3: gitpb.Widget.location:type_name -> gitpb.Location 5, // 4: gitpb.Widget.TK:type_name -> google.protobuf.Any 3, // 5: gitpb.Widgets.Widgets:type_name -> gitpb.Widget 6, // [6:6] is the sub-list for method output_type 6, // [6:6] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name 6, // [6:6] is the sub-list for extension extendee 0, // [0:6] is the sub-list for field type_name } func init() { file_widget_proto_init() } func file_widget_proto_init() { if File_widget_proto != nil { return } if !protoimpl.UnsafeEnabled { file_widget_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Size); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_widget_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Location); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_widget_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Tree); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_widget_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Widget); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_widget_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Widgets); 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{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_widget_proto_rawDesc, NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 0, }, GoTypes: file_widget_proto_goTypes, DependencyIndexes: file_widget_proto_depIdxs, MessageInfos: file_widget_proto_msgTypes, }.Build() File_widget_proto = out.File file_widget_proto_rawDesc = nil file_widget_proto_goTypes = nil file_widget_proto_depIdxs = nil } // `autogen:widget.sort.pb.go` // Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. // This file was autogenerated with autogenpb v0.0.52-1-g4fdcc99 2025.02.12_1512 // go install go.wit.com/apps/autogenpb@latest // // define which structs (messages) you want to use in the .proto file // Then sort.pb.go and marshal.pb.go files are autogenerated // // autogenpb uses it and has an example .proto file with instructions // package guipb import ( "fmt" "sync" ) // a simple global lock var widgetMu sync.RWMutex func (x *Widgets) fixUuid() { if x == nil { return } if x.Uuid == "0331fcd7-3c8c-43e4-be1b-77db6a6bc58c" { return } x.Uuid = "0331fcd7-3c8c-43e4-be1b-77db6a6bc58c" x.Version = "v1 go.wit.com/lib/protobuf/guipb" } func NewWidgets() *Widgets { x := new(Widgets) x.Uuid = "0331fcd7-3c8c-43e4-be1b-77db6a6bc58c" x.Version = "v1 go.wit.com/lib/protobuf/guipb" return x } // START SORT // DEFINE THE Widgets ITERATOR. // itializes a new iterator. func newWidgetsIterator(things []*Widgets) *WidgetsIterator { return &WidgetsIterator{things: things} } type WidgetsIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Widgets index int } func (it *WidgetsIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *WidgetsIterator) Next() *Widgets { if it.things[it.index-1] == nil { fmt.Println("Next() error in WidgetsIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Widget ITERATOR. // itializes a new iterator. func newWidgetIterator(things []*Widget) *WidgetIterator { return &WidgetIterator{things: things} } type WidgetIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Widget index int } func (it *WidgetIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *WidgetIterator) Next() *Widget { if it.things[it.index-1] == nil { fmt.Println("Next() error in WidgetIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Size ITERATOR. // itializes a new iterator. func newSizeIterator(things []*Size) *SizeIterator { return &SizeIterator{things: things} } type SizeIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Size index int } func (it *SizeIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *SizeIterator) Next() *Size { if it.things[it.index-1] == nil { fmt.Println("Next() error in SizeIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Location ITERATOR. // itializes a new iterator. func newLocationIterator(things []*Location) *LocationIterator { return &LocationIterator{things: things} } type LocationIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Location index int } func (it *LocationIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *LocationIterator) Next() *Location { if it.things[it.index-1] == nil { fmt.Println("Next() error in LocationIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Tree ITERATOR. // itializes a new iterator. func newTreeIterator(things []*Tree) *TreeIterator { return &TreeIterator{things: things} } type TreeIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Tree index int } func (it *TreeIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *TreeIterator) Next() *Tree { if it.things[it.index-1] == nil { fmt.Println("Next() error in TreeIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // safely returns a slice of pointers to the FRUIT protobufs func (x *Widgets) allWidgets() []*Widget { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*Widget tmp = make([]*Widget, len(x.Widgets)) for i, p := range x.Widgets { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *Tree) allChildren() []*Widget { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*Widget tmp = make([]*Widget, len(x.Children)) for i, p := range x.Children { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the Widget protobufs func (x *Widgets) selectAllWidgets() []*Widget { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each Widget var tmp []*Widget tmp = make([]*Widget, len(x.Widgets)) for i, p := range x.Widgets { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the Widget protobufs func (x *Tree) selectAllChildren() []*Widget { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each Widget var tmp []*Widget tmp = make([]*Widget, len(x.Children)) for i, p := range x.Children { tmp[i] = p // Copy pointers for safe iteration } return tmp } // END SORT func (x *Widgets) Len() int { x.RLock() defer x.RUnlock() return len(x.Widgets) } // just a simple Append() shortcut (but still uses the mutex lock) func (x *Widgets) Append(y *Widget) { x.Lock() defer x.Unlock() x.Widgets = append(x.Widgets, y) } func (x *Widgets) All() *WidgetIterator { WidgetPointers := x.selectAllWidgets() iterator := newWidgetIterator(WidgetPointers) return iterator } func (x *Widgets) Delete(y *Widget) bool { x.Lock() defer x.Unlock() for i, _ := range x.Widgets { if x.Widgets[i] == y { x.Widgets[i] = x.Widgets[len(x.Widgets)-1] x.Widgets = x.Widgets[:len(x.Widgets)-1] return true } } return false } // `autogen:`