diff --git a/mapped/cloud/types/iso_duration.proto b/mapped/cloud/types/iso_duration.proto new file mode 100644 index 0000000..9ae822e --- /dev/null +++ b/mapped/cloud/types/iso_duration.proto @@ -0,0 +1,38 @@ +// Copyright 2020 Google LLC +// Copyright 2022 Mapped Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package mapped.cloud.types; + +option cc_enable_arenas = true; +option java_multiple_files = true; +option java_package = "com.mapped.cloud.types"; +option csharp_namespace = "Mapped.Cloud.Types"; +option go_package = "go.mapped.dev/pb/cloud/types;types"; + +// We don't support floating points for those fields because they are vulnerable to precision loss when converting to/from JSON/other langauges. +// Practially we don't want to allow 0.5 years of 0.3 months while fine-grained seconds are representd in milliseconds and nanoseconds. +message IsoDuration { + int32 years = 1; + int32 months = 2; + int32 weeks = 3; + int32 days = 4; + int32 hours = 5; + int32 minutes = 6; + int32 seconds = 7; + int32 milliseconds = 8; + int32 nanoseconds = 9; +} diff --git a/mapped/cloud/types/typed_value.proto b/mapped/cloud/types/typed_value.proto index c1d2a0c..448d803 100644 --- a/mapped/cloud/types/typed_value.proto +++ b/mapped/cloud/types/typed_value.proto @@ -22,6 +22,7 @@ import "mapped/cloud/types/date.proto"; import "mapped/cloud/types/dayofweek.proto"; import "mapped/cloud/types/interval.proto"; import "mapped/cloud/types/money.proto"; +import "mapped/cloud/types/iso_duration.proto"; import "mapped/cloud/types/month.proto"; import "mapped/cloud/types/phone_number.proto"; import "mapped/cloud/types/postal_address.proto"; @@ -50,20 +51,6 @@ message AnyLinkedDataMap { map map = 1; } -// We don't support floating points for those fields because they are vulnerable to precision loss when converting to/from JSON/other langauges. -// Practially we don't want to allow 0.5 years of 0.3 months while fine-grained seconds are representd in milliseconds and nanoseconds. -message IsoDuration { - int32 years = 1; - int32 months = 2; - int32 weeks = 3; - int32 days = 4; - int32 hours = 5; - int32 minutes = 6; - int32 seconds = 7; - int32 milliseconds = 8; - int32 nanoseconds = 9; -} - message TypedValue { oneof value { bool bool_value = 10;