MCPcopy Index your code
hub / github.com/tinylib/msgp / AppendJSONNumber

Function AppendJSONNumber

msgp/write_bytes.go:506–520  ·  view source on GitHub ↗

AppendJSONNumber appends a json.Number to the slice. An error will be returned if the json.Number returns error as both integer and float.

(b []byte, n json.Number)

Source from the content-addressed store, hash-verified

504// AppendJSONNumber appends a json.Number to the slice.
505// An error will be returned if the json.Number returns error as both integer and float.
506func AppendJSONNumber(b []byte, n json.Number) ([]byte, error) {
507 if n == "" {
508 // The zero value outputs the 0 integer.
509 return append(b, 0), nil
510 }
511 ii, err := n.Int64()
512 if err == nil {
513 return AppendInt64(b, ii), nil
514 }
515 ff, err := n.Float64()
516 if err == nil {
517 return AppendFloat(b, ff), nil
518 }
519 return b, err
520}
521
522// AppendBytesTwoPrefixed will add the length to a bin section written with
523// 2 bytes of space saved for a bin8 header.

Callers 1

AppendIntfFunction · 0.85

Calls 2

AppendInt64Function · 0.85
AppendFloatFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…