diff --git a/docs/serialisation/protobuf.md b/docs/serialisation/protobuf.md index cb4aef8..0759d56 100644 --- a/docs/serialisation/protobuf.md +++ b/docs/serialisation/protobuf.md @@ -44,7 +44,7 @@ Protobuf supports a number of [scalar types](https://developers.google.com/proto | long | SIGNED | N/A | sint64 | | long | UNSIGNED | N/A | uint64 | | timestamp | N/A | none or PROTOBUF | message { long seconds = 1; long nanos = 2; } | -| timestamp | N/A | EPOCH_MILLIS | int64 | +| timestamp | N/A | EPOCH_MILLIS | message { long milliseconds = 1; | #### alloy.proto#protoWrapped @@ -103,7 +103,7 @@ See [here](https://protobuf.dev/programming-guides/proto3/#scalar) for documenta Timestamp shapes can be annotated with the `@alloy.proto#protoTimestampFormat` trait in order to signal what type of encoding should be used for timestamps in proto serialisation/deserialisation. -Possible values are `PROTOBUF` and `EPOCH_MILLIS`. `PROTOBUF` is the default that is used in the absence of this trait. When `EPOCH_MILLIS` is specified then the timestamp will be represented as an `int64` in the corresponding proto definition. +Possible values are `PROTOBUF` and `EPOCH_MILLIS`. `PROTOBUF` is the default that is used in the absence of this trait. When `EPOCH_MILLIS` is specified then the timestamp will be represented as a wrapped `int64` in the corresponding proto definition. #### UUIDs diff --git a/modules/protobuf/resources/alloy/protobuf/types.proto b/modules/protobuf/resources/alloy/protobuf/types.proto index 2edf39c..d71851d 100644 --- a/modules/protobuf/resources/alloy/protobuf/types.proto +++ b/modules/protobuf/resources/alloy/protobuf/types.proto @@ -6,3 +6,7 @@ message CompactUUID { int64 upper_bits = 1; int64 lower_bits = 2; } + +message EpochMillisTimestamp { + int64 milliseconds = 1; +} diff --git a/modules/protobuf/resources/alloy/protobuf/wrappers.proto b/modules/protobuf/resources/alloy/protobuf/wrappers.proto index 6d8246d..ef0ab2c 100644 --- a/modules/protobuf/resources/alloy/protobuf/wrappers.proto +++ b/modules/protobuf/resources/alloy/protobuf/wrappers.proto @@ -11,6 +11,11 @@ message TimestampValue { google.protobuf.Timestamp value = 1; } +message EpochMillisTimestampValue { + alloy.protobuf.EpochMillisTimestamp value = 1; +} + + message DocumentValue { google.protobuf.Value value = 1; }