AppendInts encodes the input ints to json and appends the encoded string list to the input byte slice.
(dst []byte, vals []int)
| 78 | // AppendInts encodes the input ints to json and |
| 79 | // appends the encoded string list to the input byte slice. |
| 80 | func (Encoder) AppendInts(dst []byte, vals []int) []byte { |
| 81 | if len(vals) == 0 { |
| 82 | return append(dst, '[', ']') |
| 83 | } |
| 84 | dst = append(dst, '[') |
| 85 | dst = strconv.AppendInt(dst, int64(vals[0]), 10) |
| 86 | if len(vals) > 1 { |
| 87 | for _, val := range vals[1:] { |
| 88 | dst = strconv.AppendInt(append(dst, ','), int64(val), 10) |
| 89 | } |
| 90 | } |
| 91 | dst = append(dst, ']') |
| 92 | return dst |
| 93 | } |
| 94 | |
| 95 | // AppendInt8 converts the input []int8 to a string and |
| 96 | // appends the encoded string to the input byte slice. |