assign assigns the specified value to the field, expecting both values not to be pointer types.
(field, value reflect.Value)
| 367 | // assign assigns the specified value to the field, |
| 368 | // expecting both values not to be pointer types. |
| 369 | func assignValue(field, value reflect.Value) { |
| 370 | switch field.Kind() { |
| 371 | case reflect.Int, reflect.Int8, reflect.Int16, |
| 372 | reflect.Int32, reflect.Int64: |
| 373 | field.SetInt(value.Int()) |
| 374 | case reflect.Uint, reflect.Uint8, reflect.Uint16, |
| 375 | reflect.Uint32, reflect.Uint64, reflect.Uintptr: |
| 376 | field.SetUint(value.Uint()) |
| 377 | case reflect.Float32, reflect.Float64: |
| 378 | field.SetFloat(value.Float()) |
| 379 | case reflect.String: |
| 380 | field.SetString(value.String()) |
| 381 | case reflect.Bool: |
| 382 | field.SetBool(value.Bool()) |
| 383 | default: |
| 384 | field.Set(value) |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | func unmarshalAttribute( |
| 389 | rawAttribute json.RawMessage, |