Skip to content

Commit

Permalink
fix: protojson {EmitUnpopulated:true}
Browse files Browse the repository at this point in the history
  • Loading branch information
tioffs committed Mar 30, 2022
1 parent b8f57a3 commit ce6810c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion handler.kafka.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ type {{.ModelNamePrivate}}Publisher struct {
}

func (r *{{.ModelNamePrivate}}Publisher) Publish(event *{{.ModelName}}Event) error {
payload, err := protojson.Marshal(event.Body)
marhal := protojson.MarshalOptions{
EmitUnpopulated: true,
}

payload, err := marhal.Marshal(event.Body)
if err != nil {
return errors.Wrap(err, "невозможно сериализовать данные")
}
Expand Down

0 comments on commit ce6810c

Please sign in to comment.