-
Notifications
You must be signed in to change notification settings - Fork 785
Open
Labels
acceptedThe defect or proposal as been acceptedThe defect or proposal as been acceptedproposalEnhancement idea or proposalEnhancement idea or proposal
Description
Proposed change
Update the implementation of jetstream.KeyValueEntry to implement json.Marshaler.
Example implementation to add to the kve type in jetstream/kv.go:
func (e *kve) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]any{
"bucket": e.Bucket(),
"key": e.Key(),
"value": string(e.Value()),
"revision": e.Revision(),
"created": e.Created(),
"delta": e.Delta(),
"op": e.Operation().String(),
})
}Use case
Related to nats-io/natscli#1552.
The motivation is to provide a standard JSON representation of the KeyValueEntry information, which would be useful for structured logging and for JSON output from the NATS CLI.
Contribution
Yes
Metadata
Metadata
Assignees
Labels
acceptedThe defect or proposal as been acceptedThe defect or proposal as been acceptedproposalEnhancement idea or proposalEnhancement idea or proposal