MCPcopy Create free account
hub / github.com/google/go-cloud / Encode

Function Encode

docstore/driver/codec.go:114–116  ·  view source on GitHub ↗

Encode encodes the value using the given Encoder. It traverses the value, iterating over arrays, slices, maps and the exported fields of structs. If it encounters a non-nil pointer, it encodes the value that it points to. Encode treats a few interfaces specially: If the value implements encoding.Bi

(v reflect.Value, e Encoder)

Source from the content-addressed store, hash-verified

112// unsigned), and types that implement encoding.TextMarshaler are permitted as map
113// keys. These restrictions match exactly those of the encoding/json package.
114func Encode(v reflect.Value, e Encoder) error {
115 return wrap(encode(v, e), gcerr.InvalidArgument)
116}
117
118func encode(v reflect.Value, enc Encoder) error {
119 if !v.IsValid() {

Callers 7

encodeValueFunction · 0.92
encodeValueFunction · 0.92
TestEncodeValueFunction · 0.92
encodeValueFunction · 0.92
encodeValueFunction · 0.92
TestEncodeFunction · 0.85
TestEncodeErrorsFunction · 0.85

Calls 2

wrapFunction · 0.85
encodeFunction · 0.85

Tested by 3

TestEncodeValueFunction · 0.74
TestEncodeFunction · 0.68
TestEncodeErrorsFunction · 0.68