An mess
This commit is contained in:
parent
7fb96a8db7
commit
f134ca4979
327
protobuffery/addressbook.pb.go
Normal file
327
protobuffery/addressbook.pb.go
Normal file
@ -0,0 +1,327 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v6.31.0
|
||||
// source: addressbook.proto
|
||||
|
||||
package __
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
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 PhoneType int32
|
||||
|
||||
const (
|
||||
PhoneType_PHONE_TYPE_UNSPECIFIED PhoneType = 0
|
||||
PhoneType_PHONE_TYPE_MOBILE PhoneType = 1
|
||||
PhoneType_PHONE_TYPE_HOME PhoneType = 2
|
||||
PhoneType_PHONE_TYPE_WORK PhoneType = 3
|
||||
)
|
||||
|
||||
// Enum value maps for PhoneType.
|
||||
var (
|
||||
PhoneType_name = map[int32]string{
|
||||
0: "PHONE_TYPE_UNSPECIFIED",
|
||||
1: "PHONE_TYPE_MOBILE",
|
||||
2: "PHONE_TYPE_HOME",
|
||||
3: "PHONE_TYPE_WORK",
|
||||
}
|
||||
PhoneType_value = map[string]int32{
|
||||
"PHONE_TYPE_UNSPECIFIED": 0,
|
||||
"PHONE_TYPE_MOBILE": 1,
|
||||
"PHONE_TYPE_HOME": 2,
|
||||
"PHONE_TYPE_WORK": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x PhoneType) Enum() *PhoneType {
|
||||
p := new(PhoneType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x PhoneType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (PhoneType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_addressbook_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (PhoneType) Type() protoreflect.EnumType {
|
||||
return &file_addressbook_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x PhoneType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PhoneType.Descriptor instead.
|
||||
func (PhoneType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_addressbook_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type Person struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
|
||||
Phones []*Person_PhoneNumber `protobuf:"bytes,4,rep,name=phones,proto3" json:"phones,omitempty"`
|
||||
LastUpdated *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Person) Reset() {
|
||||
*x = Person{}
|
||||
mi := &file_addressbook_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Person) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Person) ProtoMessage() {}
|
||||
|
||||
func (x *Person) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_addressbook_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Person.ProtoReflect.Descriptor instead.
|
||||
func (*Person) Descriptor() ([]byte, []int) {
|
||||
return file_addressbook_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Person) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Person) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Person) GetEmail() string {
|
||||
if x != nil {
|
||||
return x.Email
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Person) GetPhones() []*Person_PhoneNumber {
|
||||
if x != nil {
|
||||
return x.Phones
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Person) GetLastUpdated() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.LastUpdated
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddressBook struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
People []*Person `protobuf:"bytes,1,rep,name=people,proto3" json:"people,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddressBook) Reset() {
|
||||
*x = AddressBook{}
|
||||
mi := &file_addressbook_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddressBook) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddressBook) ProtoMessage() {}
|
||||
|
||||
func (x *AddressBook) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_addressbook_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddressBook.ProtoReflect.Descriptor instead.
|
||||
func (*AddressBook) Descriptor() ([]byte, []int) {
|
||||
return file_addressbook_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *AddressBook) GetPeople() []*Person {
|
||||
if x != nil {
|
||||
return x.People
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Person_PhoneNumber struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"`
|
||||
Type PhoneType `protobuf:"varint,2,opt,name=type,proto3,enum=tutorial.PhoneType" json:"type,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Person_PhoneNumber) Reset() {
|
||||
*x = Person_PhoneNumber{}
|
||||
mi := &file_addressbook_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Person_PhoneNumber) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Person_PhoneNumber) ProtoMessage() {}
|
||||
|
||||
func (x *Person_PhoneNumber) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_addressbook_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Person_PhoneNumber.ProtoReflect.Descriptor instead.
|
||||
func (*Person_PhoneNumber) Descriptor() ([]byte, []int) {
|
||||
return file_addressbook_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *Person_PhoneNumber) GetNumber() string {
|
||||
if x != nil {
|
||||
return x.Number
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Person_PhoneNumber) GetType() PhoneType {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return PhoneType_PHONE_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
var File_addressbook_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_addressbook_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x11addressbook.proto\x12\btutorial\x1a\x1fgoogle/protobuf/timestamp.proto\"\x87\x02\n" +
|
||||
"\x06Person\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x0e\n" +
|
||||
"\x02id\x18\x02 \x01(\x05R\x02id\x12\x14\n" +
|
||||
"\x05email\x18\x03 \x01(\tR\x05email\x124\n" +
|
||||
"\x06phones\x18\x04 \x03(\v2\x1c.tutorial.Person.PhoneNumberR\x06phones\x12=\n" +
|
||||
"\flast_updated\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\vlastUpdated\x1aN\n" +
|
||||
"\vPhoneNumber\x12\x16\n" +
|
||||
"\x06number\x18\x01 \x01(\tR\x06number\x12'\n" +
|
||||
"\x04type\x18\x02 \x01(\x0e2\x13.tutorial.PhoneTypeR\x04type\"7\n" +
|
||||
"\vAddressBook\x12(\n" +
|
||||
"\x06people\x18\x01 \x03(\v2\x10.tutorial.PersonR\x06people*h\n" +
|
||||
"\tPhoneType\x12\x1a\n" +
|
||||
"\x16PHONE_TYPE_UNSPECIFIED\x10\x00\x12\x15\n" +
|
||||
"\x11PHONE_TYPE_MOBILE\x10\x01\x12\x13\n" +
|
||||
"\x0fPHONE_TYPE_HOME\x10\x02\x12\x13\n" +
|
||||
"\x0fPHONE_TYPE_WORK\x10\x03B\x03Z\x01.b\x06proto3"
|
||||
|
||||
var (
|
||||
file_addressbook_proto_rawDescOnce sync.Once
|
||||
file_addressbook_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_addressbook_proto_rawDescGZIP() []byte {
|
||||
file_addressbook_proto_rawDescOnce.Do(func() {
|
||||
file_addressbook_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_addressbook_proto_rawDesc), len(file_addressbook_proto_rawDesc)))
|
||||
})
|
||||
return file_addressbook_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_addressbook_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_addressbook_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_addressbook_proto_goTypes = []any{
|
||||
(PhoneType)(0), // 0: tutorial.PhoneType
|
||||
(*Person)(nil), // 1: tutorial.Person
|
||||
(*AddressBook)(nil), // 2: tutorial.AddressBook
|
||||
(*Person_PhoneNumber)(nil), // 3: tutorial.Person.PhoneNumber
|
||||
(*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
|
||||
}
|
||||
var file_addressbook_proto_depIdxs = []int32{
|
||||
3, // 0: tutorial.Person.phones:type_name -> tutorial.Person.PhoneNumber
|
||||
4, // 1: tutorial.Person.last_updated:type_name -> google.protobuf.Timestamp
|
||||
1, // 2: tutorial.AddressBook.people:type_name -> tutorial.Person
|
||||
0, // 3: tutorial.Person.PhoneNumber.type:type_name -> tutorial.PhoneType
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_addressbook_proto_init() }
|
||||
func file_addressbook_proto_init() {
|
||||
if File_addressbook_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_addressbook_proto_rawDesc), len(file_addressbook_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_addressbook_proto_goTypes,
|
||||
DependencyIndexes: file_addressbook_proto_depIdxs,
|
||||
EnumInfos: file_addressbook_proto_enumTypes,
|
||||
MessageInfos: file_addressbook_proto_msgTypes,
|
||||
}.Build()
|
||||
File_addressbook_proto = out.File
|
||||
file_addressbook_proto_goTypes = nil
|
||||
file_addressbook_proto_depIdxs = nil
|
||||
}
|
32
protobuffery/addressbook.proto
Normal file
32
protobuffery/addressbook.proto
Normal file
@ -0,0 +1,32 @@
|
||||
syntax = "proto3";
|
||||
package tutorial;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = ".";
|
||||
|
||||
message Person {
|
||||
string name = 1;
|
||||
int32 id = 2;
|
||||
string email = 3;
|
||||
|
||||
message PhoneNumber {
|
||||
string number = 1;
|
||||
PhoneType type = 2;
|
||||
}
|
||||
|
||||
repeated PhoneNumber phones = 4;
|
||||
|
||||
google.protobuf.Timestamp last_updated = 5;
|
||||
}
|
||||
|
||||
enum PhoneType {
|
||||
PHONE_TYPE_UNSPECIFIED = 0;
|
||||
PHONE_TYPE_MOBILE = 1;
|
||||
PHONE_TYPE_HOME = 2;
|
||||
PHONE_TYPE_WORK = 3;
|
||||
}
|
||||
|
||||
message AddressBook {
|
||||
repeated Person people = 1;
|
||||
}
|
7
protobuffery/go.mod
Normal file
7
protobuffery/go.mod
Normal file
@ -0,0 +1,7 @@
|
||||
module git.meatballhat.com/x/box-o-sand/protobuffery
|
||||
|
||||
go 1.22
|
||||
|
||||
toolchain go1.23.10
|
||||
|
||||
require google.golang.org/protobuf v1.36.6
|
6
protobuffery/go.sum
Normal file
6
protobuffery/go.sum
Normal file
@ -0,0 +1,6 @@
|
||||
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.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
Loading…
x
Reference in New Issue
Block a user