CopyFrom copies from into v, reusing v's storage if possible.
(from Value)
| 254 | |
| 255 | // CopyFrom copies from into v, reusing v's storage if possible. |
| 256 | func (v *Value) CopyFrom(from Value) { |
| 257 | if from.IsNull() { |
| 258 | v.typ = from.typ |
| 259 | } else if _, ok := from.native(); ok { |
| 260 | *v = from |
| 261 | } else if _, ok := v.native(); ok { |
| 262 | *v = NewValue(from.Type(), bytes.Clone(from.bytes())) |
| 263 | } else { |
| 264 | *v = NewValue(from.Type(), append(v.bytes()[:0], from.bytes()...)) |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | func (v Value) IsString() bool { |
| 269 | _, ok := TypeUnder(v.Type()).(*TypeOfString) |