github.com/moleculer-go/moleculer@v0.3.3/serializer/serializer.go (about)

     1  package serializer
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/moleculer-go/moleculer"
     7  )
     8  
     9  type Serializer interface {
    10  	ReaderToPayload(io.Reader) moleculer.Payload
    11  	BytesToPayload(*[]byte) moleculer.Payload
    12  	PayloadToBytes(moleculer.Payload) []byte
    13  	PayloadToString(moleculer.Payload) string
    14  	MapToString(interface{}) string
    15  	StringToMap(string) map[string]interface{}
    16  	PayloadToContextMap(moleculer.Payload) map[string]interface{}
    17  	MapToPayload(*map[string]interface{}) (moleculer.Payload, error)
    18  }
    19  
    20  func New(broker *moleculer.BrokerDelegates) Serializer {
    21  	return CreateJSONSerializer(broker.Logger("serializer", "json"))
    22  }