mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-04 02:38:50 +00:00
812d9137df
Change the API to use explicit Has/Clear methods instead of relying on the "invalid" form of Value to represent nullability. There are several reasons for this change: * Much of the ecosystem around protobufs do not care about nullability alone. For example, for the encoder to determine whether to emit a field: it needs to first check if a field is nulled, and if not, it still needs to go through a series of type-assertion to check whether the value is the zero value. It is much easier to be able to just call Has. * It enables representing the default value as part of the value API, rather than only as part of the descriptor API. * The C++ API also uses explicit has and clear methods. However, we differ from them by defining Has for proto3 scalars (while C++ panics instead). For internal consistency, we also use a Has/Clear API for Maps. Change-Id: I30eda482c959d3e1454d72d9fc761c761ace27a6 Reviewed-on: https://go-review.googlesource.com/134998 Reviewed-by: Damien Neil <dneil@google.com> |
||
---|---|---|
.. | ||
descriptor.go | ||
placeholder_type.go | ||
placeholder.go | ||
protofile_desc.go | ||
protofile_list_gen.go | ||
protofile_list.go | ||
protofile_type.go | ||
protofile.go | ||
standalone_type.go | ||
standalone.go | ||
stringer.go | ||
type_test.go | ||
validate.go |