snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s

This commit is contained in:
upstream-mirror
2026-09-15 21:27:46 +05:00
commit ce933d1277
538 changed files with 46504 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package forwarder
import "encoding/json"
// Marshaler is used by the Forwarder Publisher to serialize the envelope sent
// to the forwarder topic, and by the Forwarder consumer to deserialize it.
//
// The interface matches the signatures of encoding/json's Marshal and Unmarshal,
// so any drop-in JSON library (e.g. github.com/bytedance/sonic, github.com/goccy/go-json)
// can be adapted with a small wrapper.
//
// The default is DefaultMarshaler, which uses encoding/json.
type Marshaler interface {
Marshal(v any) ([]byte, error)
Unmarshal(data []byte, v any) error
}
// DefaultMarshaler uses the standard library's encoding/json package.
type DefaultMarshaler struct{}
func (DefaultMarshaler) Marshal(v any) ([]byte, error) {
return json.Marshal(v)
}
func (DefaultMarshaler) Unmarshal(data []byte, v any) error {
return json.Unmarshal(data, v)
}