AppendIntf appends the concrete type of 'i' to the provided []byte. 'i' must be one of the following: - 'nil' - A bool, float, string, []byte, int, uint, or complex - A map[string]T where T is another supported type - A []T, where T is another supported type - A *T, where T is another supported type
(b []byte, i any)
| 395 | // - A type that satisfies the msgp.Marshaler interface |
| 396 | // - A type that satisfies the msgp.Extension interface |
| 397 | func AppendIntf(b []byte, i any) ([]byte, error) { |
| 398 | if i == nil { |
| 399 | return AppendNil(b), nil |
| 400 | } |
| 401 | |
| 402 | // all the concrete types |
| 403 | // for which we have methods |
| 404 | switch i := i.(type) { |
| 405 | case Marshaler: |
| 406 | return i.MarshalMsg(b) |
| 407 | case Extension: |
| 408 | return AppendExtension(b, i) |
| 409 | case bool: |
| 410 | return AppendBool(b, i), nil |
| 411 | case float32: |
| 412 | return AppendFloat32(b, i), nil |
| 413 | case float64: |
| 414 | return AppendFloat64(b, i), nil |
| 415 | case complex64: |
| 416 | return AppendComplex64(b, i), nil |
| 417 | case complex128: |
| 418 | return AppendComplex128(b, i), nil |
| 419 | case string: |
| 420 | return AppendString(b, i), nil |
| 421 | case []byte: |
| 422 | return AppendBytes(b, i), nil |
| 423 | case int8: |
| 424 | return AppendInt8(b, i), nil |
| 425 | case int16: |
| 426 | return AppendInt16(b, i), nil |
| 427 | case int32: |
| 428 | return AppendInt32(b, i), nil |
| 429 | case int64: |
| 430 | return AppendInt64(b, i), nil |
| 431 | case int: |
| 432 | return AppendInt64(b, int64(i)), nil |
| 433 | case uint: |
| 434 | return AppendUint64(b, uint64(i)), nil |
| 435 | case uint8: |
| 436 | return AppendUint8(b, i), nil |
| 437 | case uint16: |
| 438 | return AppendUint16(b, i), nil |
| 439 | case uint32: |
| 440 | return AppendUint32(b, i), nil |
| 441 | case uint64: |
| 442 | return AppendUint64(b, i), nil |
| 443 | case time.Time: |
| 444 | return AppendTime(b, i), nil |
| 445 | case time.Duration: |
| 446 | return AppendDuration(b, i), nil |
| 447 | case map[string]any: |
| 448 | return AppendMapStrIntf(b, i) |
| 449 | case map[string]string: |
| 450 | return AppendMapStrStr(b, i), nil |
| 451 | case json.Number: |
| 452 | return AppendJSONNumber(b, i) |
| 453 | case []any: |
| 454 | b = AppendArrayHeader(b, uint32(len(i))) |
searching dependent graphs…