Decode unmarshals the underlying value attached to the String to a target variable. target should be one of these: - pointer to an empty interface - pointer to a string Example: value := NewString(t, "foo") var target string value.Decode(&target) assert.Equal(t, "foo", target)
(target interface{})
| 71 | // |
| 72 | // assert.Equal(t, "foo", target) |
| 73 | func (s *String) Decode(target interface{}) *String { |
| 74 | opChain := s.chain.enter("Decode()") |
| 75 | defer opChain.leave() |
| 76 | |
| 77 | if opChain.failed() { |
| 78 | return s |
| 79 | } |
| 80 | |
| 81 | canonDecode(opChain, s.value, target) |
| 82 | return s |
| 83 | } |
| 84 | |
| 85 | // Alias is similar to Value.Alias. |
| 86 | func (s *String) Alias(name string) *String { |