Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MarshalOptions ¶
type MarshalOptions struct { // EmitUnpopulated specifies whether to emit unpopulated fields. It does not // emit unpopulated oneof fields or unpopulated extension fields. // The JSON value emitted for unpopulated fields are as follows: // ╔═══════╤════════════════════════════╗ // ║ JSON │ Protobuf field ║ // ╠═══════╪════════════════════════════╣ // ║ false │ proto3 boolean fields ║ // ║ 0 │ proto3 numeric fields ║ // ║ "" │ proto3 string/bytes fields ║ // ║ null │ proto2 scalar fields ║ // ║ null │ message fields ║ // ║ [] │ list fields ║ // ║ {} │ map fields ║ // ╚═══════╧════════════════════════════╝ EmitUnpopulated bool // EmitDefaultValues specifies whether to emit default-valued primitive fields, // empty lists, and empty maps. The fields affected are as follows: // ╔═══════╤════════════════════════════════════════╗ // ║ JSON │ Protobuf field ║ // ╠═══════╪════════════════════════════════════════╣ // ║ false │ non-optional scalar boolean fields ║ // ║ 0 │ non-optional scalar numeric fields ║ // ║ "" │ non-optional scalar string/byte fields ║ // ║ [] │ empty repeated fields ║ // ║ {} │ empty map fields ║ // ╚═══════╧════════════════════════════════════════╝ // // Behaves similarly to EmitUnpopulated, but does not emit "null"-value fields, // i.e. presence-sensing fields that are omitted will remain omitted to preserve // presence-sensing. // EmitUnpopulated takes precedence over EmitDefaultValues since the former generates // a strict superset of the latter. EmitDefaultValues bool // Resolver is used for looking up types when expanding google.protobuf.Any // messages. If nil, this defaults to using protoregistry.GlobalTypes. Resolver interface { protoregistry.ExtensionTypeResolver protoregistry.MessageTypeResolver } }
Click to show internal directories.
Click to hide internal directories.