MCPcopy Create free account
hub / github.com/kataras/iris / Marshal

Method Marshal

sessions/transcoding.go:92–110  ·  view source on GitHub ↗

Marshal returns the gob encoding of "value".

(value interface{})

Source from the content-addressed store, hash-verified

90
91// Marshal returns the gob encoding of "value".
92func (GobTranscoder) Marshal(value interface{}) ([]byte, error) {
93 var (
94 w = new(bytes.Buffer)
95 enc = gob.NewEncoder(w)
96 err error
97 )
98
99 if v, ok := value.(reflect.Value); ok {
100 err = enc.EncodeValue(v)
101 } else {
102 err = enc.Encode(&value)
103 }
104
105 if err != nil {
106 return nil, err
107 }
108
109 return w.Bytes(), nil
110}
111
112// Unmarshal parses the gob-encoded data "b" and stores the result
113// in the value pointed to by "outPtr".

Callers

nothing calls this directly

Calls 2

EncodeMethod · 0.80
BytesMethod · 0.80

Tested by

no test coverage detected