duration.pb.go 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // source: google/protobuf/duration.proto
  3. package known_proto
  4. import (
  5. protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
  6. protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry"
  7. protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
  8. protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
  9. sync "sync"
  10. )
  11. const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
  12. // A Duration represents a signed, fixed-length span of time represented
  13. // as a count of seconds and fractions of seconds at nanosecond
  14. // resolution. It is independent of any calendar and concepts like "day"
  15. // or "month". It is related to Timestamp in that the difference between
  16. // two Timestamp values is a Duration and it can be added or subtracted
  17. // from a Timestamp. Range is approximately +-10,000 years.
  18. //
  19. // # Examples
  20. //
  21. // Example 1: Compute Duration from two Timestamps in pseudo code.
  22. //
  23. // Timestamp start = ...;
  24. // Timestamp end = ...;
  25. // Duration duration = ...;
  26. //
  27. // duration.seconds = end.seconds - start.seconds;
  28. // duration.nanos = end.nanos - start.nanos;
  29. //
  30. // if (duration.seconds < 0 && duration.nanos > 0) {
  31. // duration.seconds += 1;
  32. // duration.nanos -= 1000000000;
  33. // } else if (durations.seconds > 0 && duration.nanos < 0) {
  34. // duration.seconds -= 1;
  35. // duration.nanos += 1000000000;
  36. // }
  37. //
  38. // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  39. //
  40. // Timestamp start = ...;
  41. // Duration duration = ...;
  42. // Timestamp end = ...;
  43. //
  44. // end.seconds = start.seconds + duration.seconds;
  45. // end.nanos = start.nanos + duration.nanos;
  46. //
  47. // if (end.nanos < 0) {
  48. // end.seconds -= 1;
  49. // end.nanos += 1000000000;
  50. // } else if (end.nanos >= 1000000000) {
  51. // end.seconds += 1;
  52. // end.nanos -= 1000000000;
  53. // }
  54. //
  55. // Example 3: Compute Duration from datetime.timedelta in Python.
  56. //
  57. // td = datetime.timedelta(days=3, minutes=10)
  58. // duration = Duration()
  59. // duration.FromTimedelta(td)
  60. //
  61. // # JSON Mapping
  62. //
  63. // In JSON format, the Duration type is encoded as a string rather than an
  64. // object, where the string ends in the suffix "s" (indicating seconds) and
  65. // is preceded by the number of seconds, with nanoseconds expressed as
  66. // fractional seconds. For example, 3 seconds with 0 nanoseconds should be
  67. // encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
  68. // be expressed in JSON format as "3.000000001s", and 3 seconds and 1
  69. // microsecond should be expressed in JSON format as "3.000001s".
  70. //
  71. //
  72. type Duration struct {
  73. // Signed seconds of the span of time. Must be from -315,576,000,000
  74. // to +315,576,000,000 inclusive. Note: these bounds are computed from:
  75. // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
  76. Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
  77. // Signed fractions of a second at nanosecond resolution of the span
  78. // of time. Durations less than one second are represented with a 0
  79. // `seconds` field and a positive or negative `nanos` field. For durations
  80. // of one second or more, a non-zero value for the `nanos` field must be
  81. // of the same sign as the `seconds` field. Must be from -999,999,999
  82. // to +999,999,999 inclusive.
  83. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
  84. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  85. XXX_unrecognized protoimpl.UnknownFields `json:"-"`
  86. XXX_sizecache protoimpl.SizeCache `json:"-"`
  87. }
  88. func (x *Duration) Reset() {
  89. *x = Duration{}
  90. }
  91. func (x *Duration) String() string {
  92. return protoimpl.X.MessageStringOf(x)
  93. }
  94. func (*Duration) ProtoMessage() {}
  95. func (x *Duration) ProtoReflect() protoreflect.Message {
  96. return file_google_protobuf_duration_proto_msgTypes[0].MessageOf(x)
  97. }
  98. func (m *Duration) XXX_Methods() *protoiface.Methods {
  99. return file_google_protobuf_duration_proto_msgTypes[0].Methods()
  100. }
  101. // Deprecated: Use Duration.ProtoReflect.Type instead.
  102. func (*Duration) Descriptor() ([]byte, []int) {
  103. return file_google_protobuf_duration_proto_rawDescGZIP(), []int{0}
  104. }
  105. func (*Duration) XXX_WellKnownType() string { return "Duration" }
  106. func (x *Duration) GetSeconds() int64 {
  107. if x != nil {
  108. return x.Seconds
  109. }
  110. return 0
  111. }
  112. func (x *Duration) GetNanos() int32 {
  113. if x != nil {
  114. return x.Nanos
  115. }
  116. return 0
  117. }
  118. var File_google_protobuf_duration_proto protoreflect.FileDescriptor
  119. var file_google_protobuf_duration_proto_rawDesc = []byte{
  120. 0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
  121. 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
  122. 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
  123. 0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a,
  124. 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
  125. 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73,
  126. 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x87, 0x01,
  127. 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
  128. 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50,
  129. 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
  130. 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
  131. 0x75, 0x66, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77,
  132. 0x6e, 0x3b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xf8, 0x01, 0x01,
  133. 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
  134. 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f,
  135. 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
  136. }
  137. var (
  138. file_google_protobuf_duration_proto_rawDescOnce sync.Once
  139. file_google_protobuf_duration_proto_rawDescData = file_google_protobuf_duration_proto_rawDesc
  140. )
  141. func file_google_protobuf_duration_proto_rawDescGZIP() []byte {
  142. file_google_protobuf_duration_proto_rawDescOnce.Do(func() {
  143. file_google_protobuf_duration_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_duration_proto_rawDescData)
  144. })
  145. return file_google_protobuf_duration_proto_rawDescData
  146. }
  147. var file_google_protobuf_duration_proto_msgTypes = make([]protoimpl.MessageType, 1)
  148. var file_google_protobuf_duration_proto_goTypes = []interface{}{
  149. (*Duration)(nil), // 0: google.protobuf.Duration
  150. }
  151. var file_google_protobuf_duration_proto_depIdxs = []int32{}
  152. func init() { file_google_protobuf_duration_proto_init() }
  153. func file_google_protobuf_duration_proto_init() {
  154. if File_google_protobuf_duration_proto != nil {
  155. return
  156. }
  157. File_google_protobuf_duration_proto = protoimpl.FileBuilder{
  158. RawDescriptor: file_google_protobuf_duration_proto_rawDesc,
  159. GoTypes: file_google_protobuf_duration_proto_goTypes,
  160. DependencyIndexes: file_google_protobuf_duration_proto_depIdxs,
  161. MessageOutputTypes: file_google_protobuf_duration_proto_msgTypes,
  162. FilesRegistry: protoregistry.GlobalFiles,
  163. TypesRegistry: protoregistry.GlobalTypes,
  164. }.Init()
  165. file_google_protobuf_duration_proto_rawDesc = nil
  166. file_google_protobuf_duration_proto_goTypes = nil
  167. file_google_protobuf_duration_proto_depIdxs = nil
  168. }