Initial commit
This commit is contained in:
369
haberdasher/service.pb.go
Normal file
369
haberdasher/service.pb.go
Normal file
@ -0,0 +1,369 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.14.0
|
||||
// source: haberdasher/service.proto
|
||||
|
||||
package haberdasher
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
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 HatQuery struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HatQuery) Reset() {
|
||||
*x = HatQuery{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_haberdasher_service_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *HatQuery) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HatQuery) ProtoMessage() {}
|
||||
|
||||
func (x *HatQuery) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_haberdasher_service_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 HatQuery.ProtoReflect.Descriptor instead.
|
||||
func (*HatQuery) Descriptor() ([]byte, []int) {
|
||||
return file_haberdasher_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *HatQuery) GetLimit() int32 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Size of a Hat, in inches.
|
||||
type Size struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Inches int32 `protobuf:"varint,1,opt,name=inches,proto3" json:"inches,omitempty"` // must be > 0
|
||||
}
|
||||
|
||||
func (x *Size) Reset() {
|
||||
*x = Size{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_haberdasher_service_proto_msgTypes[1]
|
||||
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_haberdasher_service_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 Size.ProtoReflect.Descriptor instead.
|
||||
func (*Size) Descriptor() ([]byte, []int) {
|
||||
return file_haberdasher_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Size) GetInches() int32 {
|
||||
if x != nil {
|
||||
return x.Inches
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// A Hat is a piece of headwear made by a Haberdasher.
|
||||
type Hat struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Inches int32 `protobuf:"varint,1,opt,name=inches,proto3" json:"inches,omitempty"`
|
||||
Color string `protobuf:"bytes,2,opt,name=color,proto3" json:"color,omitempty"` // anything but "invisible"
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // i.e. "bowler"
|
||||
}
|
||||
|
||||
func (x *Hat) Reset() {
|
||||
*x = Hat{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_haberdasher_service_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Hat) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Hat) ProtoMessage() {}
|
||||
|
||||
func (x *Hat) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_haberdasher_service_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 Hat.ProtoReflect.Descriptor instead.
|
||||
func (*Hat) Descriptor() ([]byte, []int) {
|
||||
return file_haberdasher_service_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *Hat) GetInches() int32 {
|
||||
if x != nil {
|
||||
return x.Inches
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Hat) GetColor() string {
|
||||
if x != nil {
|
||||
return x.Color
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Hat) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Hats struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Hats []*Hat `protobuf:"bytes,1,rep,name=hats,proto3" json:"hats,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Hats) Reset() {
|
||||
*x = Hats{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_haberdasher_service_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Hats) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Hats) ProtoMessage() {}
|
||||
|
||||
func (x *Hats) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_haberdasher_service_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 Hats.ProtoReflect.Descriptor instead.
|
||||
func (*Hats) Descriptor() ([]byte, []int) {
|
||||
return file_haberdasher_service_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *Hats) GetHats() []*Hat {
|
||||
if x != nil {
|
||||
return x.Hats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_haberdasher_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_haberdasher_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x19, 0x68, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x2f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x74, 0x77, 0x69,
|
||||
0x72, 0x70, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x68, 0x61, 0x62, 0x65, 0x72,
|
||||
0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x22, 0x20, 0x0a, 0x08, 0x48, 0x61, 0x74, 0x51, 0x75, 0x65,
|
||||
0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x1e, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x22, 0x47, 0x0a, 0x03, 0x48, 0x61, 0x74, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x22, 0x3a, 0x0a, 0x04, 0x48, 0x61, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x04, 0x68, 0x61, 0x74,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x68, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73,
|
||||
0x68, 0x65, 0x72, 0x2e, 0x48, 0x61, 0x74, 0x52, 0x04, 0x68, 0x61, 0x74, 0x73, 0x32, 0xab, 0x01,
|
||||
0x0a, 0x0b, 0x48, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x12, 0x4a, 0x0a,
|
||||
0x07, 0x4d, 0x61, 0x6b, 0x65, 0x48, 0x61, 0x74, 0x12, 0x1f, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70,
|
||||
0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x68, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61,
|
||||
0x73, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x7a, 0x65, 0x1a, 0x1e, 0x2e, 0x74, 0x77, 0x69, 0x72,
|
||||
0x70, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x68, 0x61, 0x62, 0x65, 0x72, 0x64,
|
||||
0x61, 0x73, 0x68, 0x65, 0x72, 0x2e, 0x48, 0x61, 0x74, 0x12, 0x50, 0x0a, 0x08, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x48, 0x61, 0x74, 0x73, 0x12, 0x23, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x65, 0x78,
|
||||
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x68, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65,
|
||||
0x72, 0x2e, 0x48, 0x61, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x1f, 0x2e, 0x74, 0x77, 0x69,
|
||||
0x72, 0x70, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x68, 0x61, 0x62, 0x65, 0x72,
|
||||
0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x2e, 0x48, 0x61, 0x74, 0x73, 0x42, 0x1f, 0x5a, 0x1d, 0x68,
|
||||
0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x2d, 0x74, 0x77, 0x69, 0x72, 0x70,
|
||||
0x2f, 0x68, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_haberdasher_service_proto_rawDescOnce sync.Once
|
||||
file_haberdasher_service_proto_rawDescData = file_haberdasher_service_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_haberdasher_service_proto_rawDescGZIP() []byte {
|
||||
file_haberdasher_service_proto_rawDescOnce.Do(func() {
|
||||
file_haberdasher_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_haberdasher_service_proto_rawDescData)
|
||||
})
|
||||
return file_haberdasher_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_haberdasher_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_haberdasher_service_proto_goTypes = []interface{}{
|
||||
(*HatQuery)(nil), // 0: twirp.example.haberdasher.HatQuery
|
||||
(*Size)(nil), // 1: twirp.example.haberdasher.Size
|
||||
(*Hat)(nil), // 2: twirp.example.haberdasher.Hat
|
||||
(*Hats)(nil), // 3: twirp.example.haberdasher.Hats
|
||||
}
|
||||
var file_haberdasher_service_proto_depIdxs = []int32{
|
||||
2, // 0: twirp.example.haberdasher.Hats.hats:type_name -> twirp.example.haberdasher.Hat
|
||||
1, // 1: twirp.example.haberdasher.Haberdasher.MakeHat:input_type -> twirp.example.haberdasher.Size
|
||||
0, // 2: twirp.example.haberdasher.Haberdasher.ListHats:input_type -> twirp.example.haberdasher.HatQuery
|
||||
2, // 3: twirp.example.haberdasher.Haberdasher.MakeHat:output_type -> twirp.example.haberdasher.Hat
|
||||
3, // 4: twirp.example.haberdasher.Haberdasher.ListHats:output_type -> twirp.example.haberdasher.Hats
|
||||
3, // [3:5] is the sub-list for method output_type
|
||||
1, // [1:3] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_haberdasher_service_proto_init() }
|
||||
func file_haberdasher_service_proto_init() {
|
||||
if File_haberdasher_service_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_haberdasher_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HatQuery); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_haberdasher_service_proto_msgTypes[1].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_haberdasher_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Hat); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_haberdasher_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Hats); 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_haberdasher_service_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_haberdasher_service_proto_goTypes,
|
||||
DependencyIndexes: file_haberdasher_service_proto_depIdxs,
|
||||
MessageInfos: file_haberdasher_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_haberdasher_service_proto = out.File
|
||||
file_haberdasher_service_proto_rawDesc = nil
|
||||
file_haberdasher_service_proto_goTypes = nil
|
||||
file_haberdasher_service_proto_depIdxs = nil
|
||||
}
|
32
haberdasher/service.proto
Normal file
32
haberdasher/service.proto
Normal file
@ -0,0 +1,32 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package twirp.example.haberdasher;
|
||||
option go_package = "haberdasher-twirp/haberdasher";
|
||||
|
||||
// Haberdasher service makes hats for clients.
|
||||
service Haberdasher {
|
||||
// MakeHat produces a hat of mysterious, randomly-selected color!
|
||||
rpc MakeHat(Size) returns (Hat);
|
||||
|
||||
rpc ListHats(HatQuery) returns (Hats);
|
||||
}
|
||||
|
||||
message HatQuery {
|
||||
int32 limit = 1;
|
||||
}
|
||||
|
||||
// Size of a Hat, in inches.
|
||||
message Size {
|
||||
int32 inches = 1; // must be > 0
|
||||
}
|
||||
|
||||
// A Hat is a piece of headwear made by a Haberdasher.
|
||||
message Hat {
|
||||
int32 inches = 1;
|
||||
string color = 2; // anything but "invisible"
|
||||
string name = 3; // i.e. "bowler"
|
||||
}
|
||||
|
||||
message Hats {
|
||||
repeated Hat hats = 1;
|
||||
}
|
1392
haberdasher/service.twirp.go
Normal file
1392
haberdasher/service.twirp.go
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user