mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-26 10:43:42 +02:00
transport/message/encoder.go: Define the Encoder type
This commit is contained in:
parent
38ae3a4630
commit
2c3af6e4c5
1 changed files with 3 additions and 0 deletions
|
|
@ -6,6 +6,9 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Encoder is a function that can encode a object to the encoded format.
|
||||||
|
type Encoder func(v any) ([]byte, error)
|
||||||
|
|
||||||
func Encode(v interface{}) ([]byte, bool) {
|
func Encode(v interface{}) ([]byte, bool) {
|
||||||
payload, err := json.Marshal(v)
|
payload, err := json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue