...

Source file src/google.golang.org/genproto/googleapis/type/decimal/decimal.pb.go

Documentation: google.golang.org/genproto/googleapis/type/decimal

     1  // Copyright 2024 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go. DO NOT EDIT.
    16  // versions:
    17  // 	protoc-gen-go v1.26.0
    18  // 	protoc        v4.24.4
    19  // source: google/type/decimal.proto
    20  
    21  package decimal
    22  
    23  import (
    24  	reflect "reflect"
    25  	sync "sync"
    26  
    27  	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
    28  	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
    29  )
    30  
    31  const (
    32  	// Verify that this generated code is sufficiently up-to-date.
    33  	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
    34  	// Verify that runtime/protoimpl is sufficiently up-to-date.
    35  	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
    36  )
    37  
    38  // A representation of a decimal value, such as 2.5. Clients may convert values
    39  // into language-native decimal formats, such as Java's [BigDecimal][] or
    40  // Python's [decimal.Decimal][].
    41  //
    42  // [BigDecimal]:
    43  // https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html
    44  // [decimal.Decimal]: https://docs.python.org/3/library/decimal.html
    45  type Decimal struct {
    46  	state         protoimpl.MessageState
    47  	sizeCache     protoimpl.SizeCache
    48  	unknownFields protoimpl.UnknownFields
    49  
    50  	// The decimal value, as a string.
    51  	//
    52  	// The string representation consists of an optional sign, `+` (`U+002B`)
    53  	// or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
    54  	// ("the integer"), optionally followed by a fraction, optionally followed
    55  	// by an exponent.
    56  	//
    57  	// The fraction consists of a decimal point followed by zero or more decimal
    58  	// digits. The string must contain at least one digit in either the integer
    59  	// or the fraction. The number formed by the sign, the integer and the
    60  	// fraction is referred to as the significand.
    61  	//
    62  	// The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
    63  	// followed by one or more decimal digits.
    64  	//
    65  	// Services **should** normalize decimal values before storing them by:
    66  	//
    67  	//   - Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`).
    68  	//   - Replacing a zero-length integer value with `0` (`.5` -> `0.5`).
    69  	//   - Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`).
    70  	//   - Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`).
    71  	//
    72  	// Services **may** perform additional normalization based on its own needs
    73  	// and the internal decimal implementation selected, such as shifting the
    74  	// decimal point and exponent value together (example: `2.5e-1` <-> `0.25`).
    75  	// Additionally, services **may** preserve trailing zeroes in the fraction
    76  	// to indicate increased precision, but are not required to do so.
    77  	//
    78  	// Note that only the `.` character is supported to divide the integer
    79  	// and the fraction; `,` **should not** be supported regardless of locale.
    80  	// Additionally, thousand separators **should not** be supported. If a
    81  	// service does support them, values **must** be normalized.
    82  	//
    83  	// The ENBF grammar is:
    84  	//
    85  	//	DecimalString =
    86  	//	  [Sign] Significand [Exponent];
    87  	//
    88  	//	Sign = '+' | '-';
    89  	//
    90  	//	Significand =
    91  	//	  Digits ['.'] [Digits] | [Digits] '.' Digits;
    92  	//
    93  	//	Exponent = ('e' | 'E') [Sign] Digits;
    94  	//
    95  	//	Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };
    96  	//
    97  	// Services **should** clearly document the range of supported values, the
    98  	// maximum supported precision (total number of digits), and, if applicable,
    99  	// the scale (number of digits after the decimal point), as well as how it
   100  	// behaves when receiving out-of-bounds values.
   101  	//
   102  	// Services **may** choose to accept values passed as input even when the
   103  	// value has a higher precision or scale than the service supports, and
   104  	// **should** round the value to fit the supported scale. Alternatively, the
   105  	// service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
   106  	// if precision would be lost.
   107  	//
   108  	// Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
   109  	// gRPC) if the service receives a value outside of the supported range.
   110  	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
   111  }
   112  
   113  func (x *Decimal) Reset() {
   114  	*x = Decimal{}
   115  	if protoimpl.UnsafeEnabled {
   116  		mi := &file_google_type_decimal_proto_msgTypes[0]
   117  		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
   118  		ms.StoreMessageInfo(mi)
   119  	}
   120  }
   121  
   122  func (x *Decimal) String() string {
   123  	return protoimpl.X.MessageStringOf(x)
   124  }
   125  
   126  func (*Decimal) ProtoMessage() {}
   127  
   128  func (x *Decimal) ProtoReflect() protoreflect.Message {
   129  	mi := &file_google_type_decimal_proto_msgTypes[0]
   130  	if protoimpl.UnsafeEnabled && x != nil {
   131  		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
   132  		if ms.LoadMessageInfo() == nil {
   133  			ms.StoreMessageInfo(mi)
   134  		}
   135  		return ms
   136  	}
   137  	return mi.MessageOf(x)
   138  }
   139  
   140  // Deprecated: Use Decimal.ProtoReflect.Descriptor instead.
   141  func (*Decimal) Descriptor() ([]byte, []int) {
   142  	return file_google_type_decimal_proto_rawDescGZIP(), []int{0}
   143  }
   144  
   145  func (x *Decimal) GetValue() string {
   146  	if x != nil {
   147  		return x.Value
   148  	}
   149  	return ""
   150  }
   151  
   152  var File_google_type_decimal_proto protoreflect.FileDescriptor
   153  
   154  var file_google_type_decimal_proto_rawDesc = []byte{
   155  	0x0a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x64, 0x65,
   156  	0x63, 0x69, 0x6d, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x67, 0x6f, 0x6f,
   157  	0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x69,
   158  	0x6d, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01,
   159  	0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x66, 0x0a, 0x0f, 0x63, 0x6f, 0x6d,
   160  	0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0c, 0x44, 0x65,
   161  	0x63, 0x69, 0x6d, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 0x67, 0x6f,
   162  	0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f,
   163  	0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61,
   164  	0x70, 0x69, 0x73, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c,
   165  	0x3b, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x54,
   166  	0x50, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
   167  }
   168  
   169  var (
   170  	file_google_type_decimal_proto_rawDescOnce sync.Once
   171  	file_google_type_decimal_proto_rawDescData = file_google_type_decimal_proto_rawDesc
   172  )
   173  
   174  func file_google_type_decimal_proto_rawDescGZIP() []byte {
   175  	file_google_type_decimal_proto_rawDescOnce.Do(func() {
   176  		file_google_type_decimal_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_type_decimal_proto_rawDescData)
   177  	})
   178  	return file_google_type_decimal_proto_rawDescData
   179  }
   180  
   181  var file_google_type_decimal_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
   182  var file_google_type_decimal_proto_goTypes = []interface{}{
   183  	(*Decimal)(nil), // 0: google.type.Decimal
   184  }
   185  var file_google_type_decimal_proto_depIdxs = []int32{
   186  	0, // [0:0] is the sub-list for method output_type
   187  	0, // [0:0] is the sub-list for method input_type
   188  	0, // [0:0] is the sub-list for extension type_name
   189  	0, // [0:0] is the sub-list for extension extendee
   190  	0, // [0:0] is the sub-list for field type_name
   191  }
   192  
   193  func init() { file_google_type_decimal_proto_init() }
   194  func file_google_type_decimal_proto_init() {
   195  	if File_google_type_decimal_proto != nil {
   196  		return
   197  	}
   198  	if !protoimpl.UnsafeEnabled {
   199  		file_google_type_decimal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
   200  			switch v := v.(*Decimal); i {
   201  			case 0:
   202  				return &v.state
   203  			case 1:
   204  				return &v.sizeCache
   205  			case 2:
   206  				return &v.unknownFields
   207  			default:
   208  				return nil
   209  			}
   210  		}
   211  	}
   212  	type x struct{}
   213  	out := protoimpl.TypeBuilder{
   214  		File: protoimpl.DescBuilder{
   215  			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
   216  			RawDescriptor: file_google_type_decimal_proto_rawDesc,
   217  			NumEnums:      0,
   218  			NumMessages:   1,
   219  			NumExtensions: 0,
   220  			NumServices:   0,
   221  		},
   222  		GoTypes:           file_google_type_decimal_proto_goTypes,
   223  		DependencyIndexes: file_google_type_decimal_proto_depIdxs,
   224  		MessageInfos:      file_google_type_decimal_proto_msgTypes,
   225  	}.Build()
   226  	File_google_type_decimal_proto = out.File
   227  	file_google_type_decimal_proto_rawDesc = nil
   228  	file_google_type_decimal_proto_goTypes = nil
   229  	file_google_type_decimal_proto_depIdxs = nil
   230  }
   231  

View as plain text