What are the well-known types in Protocol Buffers (Timestamp, Duration, Any, Empty, wrappers) and when would you use them?
Last updated
Well-known types are standard Google messages (
google/protobuf/*.proto) with idiomatic language mappings and canonical JSON forms.Timestampis an absolute UTC time andDurationis a time span.Anyholds a runtime-determined message type, andEmptyserves as a no-data request or response.Wrappers like
Int32ValueandStringValuebox scalars so you can tell "unset" apart from the zero default in proto3.
- https://learn.microsoft.com/en-us/aspnet/core/grpc/protobuf?view=aspnetcore-10.0
- https://victoriametrics.com/blog/go-protobuf-basic/
- https://gripmock.org/guide/types/well-known-types.html
- https://hosseinnejati.medium.com/protocol-buffers-fundamentals-messages-fields-and-encoding-e5366b52ed26
- https://sonny-alvesdias.medium.com/grpc-proto-files-best-practices-1fc3f7342027
- https://victoriametrics.com/tags/go/page/2/