trpc.group/trpc-go/trpc-go@v1.0.3/testdata/restful/helloworld/helloworld.proto (about) 1 // 2 // 3 // Tencent is pleased to support the open source community by making tRPC available. 4 // 5 // Copyright (C) 2023 THL A29 Limited, a Tencent company. 6 // All rights reserved. 7 // 8 // If you have downloaded a copy of the tRPC source code from Tencent, 9 // please note that tRPC source code is licensed under the Apache 2.0 License, 10 // A copy of the Apache 2.0 License is included in this file. 11 // 12 // 13 14 syntax = "proto3"; 15 16 package trpc.examples.restful.helloworld; 17 18 option go_package = "trpc.group/trpc-go/trpc-go/examples/restful/helloworld"; 19 20 import "trpc/api/annotations.proto"; 21 22 import "google/protobuf/wrappers.proto"; 23 import "google/protobuf/empty.proto"; 24 import "google/protobuf/timestamp.proto"; 25 import "google/protobuf/duration.proto"; 26 import "google/protobuf/field_mask.proto"; 27 28 // Greeter 服务 29 service Greeter { 30 rpc SayHello(HelloRequest) returns (HelloReply) { 31 option (trpc.api.http) = { 32 post: "/v1/foobar" 33 body: "*" 34 additional_bindings: { 35 post: "/v1/foo/{name}" 36 } 37 additional_bindings: { 38 get: "/v2/bar" 39 } 40 }; 41 } 42 } 43 44 // Hello 请求 45 message HelloRequest { 46 string name = 1; 47 NestedOuter single_nested = 2; 48 bytes primitive_bytes_value = 3; 49 bool primitive_bool_value = 4; 50 float primitive_float_value = 5; 51 double primitive_double_value = 6; 52 int32 primitive_int32_value = 7; 53 uint32 primitive_uint32_value = 8; 54 int64 primitive_int64_value = 9; 55 uint64 primitive_uint64_value = 10; 56 fixed32 primitive_fixed32_value = 11; 57 fixed64 primitive_fixed64_value = 12; 58 sint32 primitive_sint32_value = 13; 59 sint64 primitive_sint64_value = 14; 60 sfixed32 primitive_sfixed32_value = 15; 61 sfixed64 primitive_sfixed64_value = 16; 62 NumericEnum enum_value = 17; 63 oneof oneof_value { 64 google.protobuf.Empty oneof_empty = 18; 65 string oneof_string = 19; 66 } 67 repeated string repeated_string_value = 20; 68 repeated NumericEnum repeated_enum_value = 21; 69 repeated NestedOuter repeated_nested_value = 22; 70 map<string, string> mapped_string_value = 23; 71 map<string, NumericEnum> mapped_enum_value = 24; 72 map<string, NestedOuter> mapped_nested_value = 25; 73 google.protobuf.Timestamp time = 26; 74 google.protobuf.Duration duration = 27; 75 google.protobuf.StringValue wrapped_str_value = 28; 76 google.protobuf.FloatValue wrapped_float_value = 29; 77 google.protobuf.DoubleValue wrapped_double_value = 30; 78 google.protobuf.BoolValue wrapped_bool_value = 31; 79 google.protobuf.BytesValue wrapped_bytes_value = 32; 80 google.protobuf.Int32Value wrapped_int32_value = 33; 81 google.protobuf.UInt32Value wrapped_uint32_value = 34; 82 google.protobuf.Int64Value wrapped_int64_value = 35; 83 google.protobuf.UInt64Value wrapped_uint64_value = 36; 84 google.protobuf.FieldMask mask_value = 37; 85 } 86 87 // Hello 响应 88 message HelloReply { 89 string message = 1; 90 } 91 92 // 数字枚举 93 enum NumericEnum { 94 ZERO = 0; 95 ONE = 1; 96 } 97 98 // 嵌套外层 99 message NestedOuter { 100 string name = 1; 101 uint32 amount = 2; 102 enum DeepEnum { 103 FALSE = 0; 104 TRUE = 1; 105 } 106 DeepEnum ok = 3; 107 NestedInner inner = 4; 108 } 109 110 // 嵌套内层 111 message NestedInner { 112 bool a = 1; 113 bool b = 2; 114 }