blob: 5f526980de723b317b060c44092897ca203760a8 [file] [log] [blame]
Chenwei Xiao1bbf6f32022-06-10 06:52:50 +08001// See README.md for information and build instructions.
Tim Swastbc472342015-12-01 17:07:18 -08002//
3// Note: START and END tags are used in comments to define sections used in
4// tutorials. They are not part of the syntax for Protocol Buffers.
5//
6// To get an in-depth walkthrough of this file and the related examples, see:
7// https://developers.google.com/protocol-buffers/docs/tutorials
temporal40ee5512008-07-10 02:12:20 +00008
Tim Swastbc472342015-12-01 17:07:18 -08009// [START declaration]
Jan Tattermusch69c14072015-07-20 14:32:57 -070010syntax = "proto3";
temporal40ee5512008-07-10 02:12:20 +000011package tutorial;
Feng Xiao74bf45f2017-09-08 15:44:09 -070012
13import "google/protobuf/timestamp.proto";
Tim Swastbc472342015-12-01 17:07:18 -080014// [END declaration]
temporal40ee5512008-07-10 02:12:20 +000015
Tim Swastbc472342015-12-01 17:07:18 -080016// [START java_declaration]
Chris Rebert9d175492021-03-31 17:13:01 -070017option java_multiple_files = true;
18option java_package = "com.example.tutorial.protos";
temporal40ee5512008-07-10 02:12:20 +000019option java_outer_classname = "AddressBookProtos";
Tim Swastbc472342015-12-01 17:07:18 -080020// [END java_declaration]
temporal40ee5512008-07-10 02:12:20 +000021
Tim Swastbc472342015-12-01 17:07:18 -080022// [START csharp_declaration]
23option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
24// [END csharp_declaration]
25
Dan Kortschak32af37a2021-04-21 00:55:58 +093026// [START go_declaration]
Damien Neilc8dfe322021-10-21 13:27:40 -070027option go_package = "github.com/protocolbuffers/protobuf/examples/go/tutorialpb";
Dan Kortschak32af37a2021-04-21 00:55:58 +093028// [END go_declaration]
29
Tim Swastbc472342015-12-01 17:07:18 -080030// [START messages]
temporal40ee5512008-07-10 02:12:20 +000031message Person {
Jan Tattermusch69c14072015-07-20 14:32:57 -070032 string name = 1;
Tim Swastbc472342015-12-01 17:07:18 -080033 int32 id = 2; // Unique ID number for this person.
Jan Tattermusch69c14072015-07-20 14:32:57 -070034 string email = 3;
temporal40ee5512008-07-10 02:12:20 +000035
36 enum PhoneType {
37 MOBILE = 0;
38 HOME = 1;
39 WORK = 2;
40 }
41
42 message PhoneNumber {
Jan Tattermusch69c14072015-07-20 14:32:57 -070043 string number = 1;
44 PhoneType type = 2;
temporal40ee5512008-07-10 02:12:20 +000045 }
46
Jan Tattermusch69c14072015-07-20 14:32:57 -070047 repeated PhoneNumber phones = 4;
Feng Xiao74bf45f2017-09-08 15:44:09 -070048
49 google.protobuf.Timestamp last_updated = 5;
temporal40ee5512008-07-10 02:12:20 +000050}
51
52// Our address book file is just one of these.
53message AddressBook {
Jan Tattermuschb0e5ba62015-07-20 15:24:08 -070054 repeated Person people = 1;
temporal40ee5512008-07-10 02:12:20 +000055}
Tim Swastbc472342015-12-01 17:07:18 -080056// [END messages]