MCPcopy Index your code
hub / github.com/gavv/httpexpect / Decode

Method Decode

array.go:98–108  ·  view source on GitHub ↗

Decode unmarshals the underlying value attached to the Array to a target variable. target should be one of these: - pointer to an empty interface - pointer to a slice of any type Example: type S struct{ Foo int `json:foo` } value := []interface{}{ map[string]interface{}{ "foo": 123, }

(target interface{})

Source from the content-addressed store, hash-verified

96//
97// assert.Equal(t, []S{{123}, {456}}, target)
98func (a *Array) Decode(target interface{}) *Array {
99 opChain := a.chain.enter("Decode()")
100 defer opChain.leave()
101
102 if opChain.failed() {
103 return a
104 }
105
106 canonDecode(opChain, a.value, target)
107 return a
108}
109
110// Alias is similar to Value.Alias.
111func (a *Array) Alias(name string) *Array {

Callers 1

TestArray_DecodeFunction · 0.95

Calls 4

canonDecodeFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80

Tested by 1

TestArray_DecodeFunction · 0.76