MCPcopy Index your code
hub / github.com/koding/kite / Unmarshal

Method Unmarshal

dnode/partial.go:34–52  ·  view source on GitHub ↗

Unmarshal unmarshals the raw data (p.Raw) into v and prepares callbacks. v must be a struct that is the type of expected arguments.

(v interface{})

Source from the content-addressed store, hash-verified

32// Unmarshal unmarshals the raw data (p.Raw) into v and prepares callbacks.
33// v must be a struct that is the type of expected arguments.
34func (p *Partial) Unmarshal(v interface{}) error {
35 if p == nil {
36 return fmt.Errorf("Cannot unmarshal nil argument")
37 }
38
39 if err := json.Unmarshal(p.Raw, &v); err != nil {
40 return fmt.Errorf("%s. Data: %s", err.Error(), string(p.Raw))
41 }
42
43 value := reflect.ValueOf(v)
44
45 for _, spec := range p.CallbackSpecs {
46 if err := setCallback(value, spec.Path, spec.Function.Caller.(functionReceived)); err != nil {
47 return err
48 }
49 }
50
51 return nil
52}
53
54func (p *Partial) MustUnmarshal(v interface{}) {
55 err := p.Unmarshal(v)

Callers 15

MustUnmarshalMethod · 0.95
SliceMethod · 0.95
SliceOfLengthMethod · 0.95
MapMethod · 0.95
StringMethod · 0.95
Float64Method · 0.95
BoolMethod · 0.95
FunctionMethod · 0.95
getKitesMethod · 0.80
GetTokenMethod · 0.80
GetTokenForceMethod · 0.80
GetKeyMethod · 0.80

Calls 2

setCallbackFunction · 0.85
ErrorMethod · 0.65

Tested by 4

TestKite_MultipleDialFunction · 0.64
TestKontrolFunction · 0.64
TestKontrolMultiKeyFunction · 0.64