mochi-mqtt / server

The fully compliant, embeddable high-performance Go MQTT v5 server for IoT, smarthome, and pubsub
MIT License
1.3k stars 223 forks source link

Added `omitempty` to storage structs #401

Closed snej closed 6 months ago

snej commented 6 months ago

Adding omitempty to the JSON metadata of the storage struct fields significantly cuts down the size of the marshaled JSON when a hook is persisting state to a database.

I've left it out on fields that, in my experience, never have the default value; but if you feel it should be consistent on all fields, I can add it to the rest.

snej commented 6 months ago

My bad, I forgot to run tests and it appears some test expects the missing fields to exist.

mochi-co commented 6 months ago

This looks good to me, thank you @snej! Apologies for the long wait.