@@ -87,16 +87,16 @@ type jsonEntry struct {
8787}
8888
8989// jsonEntryAux is a helper struct to support marshalling the content to scan as either
90- // a UTF-8 string in `content ` or a base64-encoded bytestring in `content_base64 `.
90+ // a UTF-8 string in `data ` or a base64-encoded bytestring in `data_b64 `.
9191type jsonEntryAux struct {
9292 Metadata * json.RawMessage `json:"metadata"`
9393 Data * string `json:"data,omitempty"`
9494 DataB64 * []byte `json:"data_b64,omitempty"`
9595}
9696
97- // MarshalJSON implements custom JSON marshaling for envelope .
98- // If Content is valid UTF-8, it's serialized as "content" ( string) .
99- // If Content is not valid UTF-8, it's base64-encoded and serialized as "content_b64" .
97+ // MarshalJSON implements custom JSON marshaling for jsonEntry .
98+ // If Data is valid UTF-8, it's serialized as a `data` string field .
99+ // If Data is not valid UTF-8, it's serialized as a `data_b64` base64-encoded string field .
100100func (e * jsonEntry ) MarshalJSON () ([]byte , error ) {
101101 if utf8 .Valid (e .Data ) {
102102 s := string (e .Data )
@@ -112,8 +112,7 @@ func (e *jsonEntry) MarshalJSON() ([]byte, error) {
112112 }
113113}
114114
115- // UnmarshalJSON implements custom JSON unmarshaling for envelope.
116- // It handles both "content" (string) and "content_b64" (base64-encoded string) fields.
115+ // UnmarshalJSON implements custom JSON unmarshaling for jsonEntry.
117116func (e * jsonEntry ) UnmarshalJSON (data []byte ) error {
118117 var aux jsonEntryAux
119118 if err := json .Unmarshal (data , & aux ); err != nil {
0 commit comments