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

Method Decode

runtimevar/runtimevar.go:438–445  ·  view source on GitHub ↗

Decode decodes b into a new instance of the target type.

(ctx context.Context, b []byte)

Source from the content-addressed store, hash-verified

436
437// Decode decodes b into a new instance of the target type.
438func (d *Decoder) Decode(ctx context.Context, b []byte) (any, error) {
439 nv := reflect.New(d.typ).Interface()
440 if err := d.fn(ctx, b, nv); err != nil {
441 return nil, err
442 }
443 ptr := reflect.ValueOf(nv)
444 return ptr.Elem().Interface(), nil
445}
446
447var (
448 // StringDecoder decodes into strings.

Callers 15

decodeMessageFunction · 0.95
TestDecoderFunction · 0.95
TestDecryptDecoderFunction · 0.95
getAttrsFunction · 0.45
processOrderMethod · 0.45
FetchMethod · 0.45
FetchMethod · 0.45
GobDecodeFunction · 0.45
TestStringDecoderFunction · 0.45
TestBytesDecoderFunction · 0.45
WatchVariableMethod · 0.45
watchMethod · 0.45

Implementers 6

decoderdocstore/memdocstore/codec.go
decoderdocstore/awsdynamodb/v2/codec.go
decoderdocstore/gcpfirestore/codec.go
testDecoderdocstore/driver/codec_test.go
failDecoderdocstore/driver/codec_test.go
decoderdocstore/mongodocstore/codec.go

Calls

no outgoing calls

Tested by 5

TestDecoderFunction · 0.76
TestDecryptDecoderFunction · 0.76
TestStringDecoderFunction · 0.36
TestBytesDecoderFunction · 0.36
MakeWatcherMethod · 0.36