append ints

This commit is contained in:
Josh Baker 2017-04-21 19:41:41 -07:00
parent 8b15dea700
commit 5cce96d461
1 changed files with 4 additions and 4 deletions

View File

@ -424,14 +424,14 @@ func (w *Writer) WriteNull() {
// c.WriteBulk("item 2") // c.WriteBulk("item 2")
func (w *Writer) WriteArray(count int) { func (w *Writer) WriteArray(count int) {
w.b = append(w.b, '*') w.b = append(w.b, '*')
w.b = append(w.b, strconv.FormatInt(int64(count), 10)...) w.b = strconv.AppendInt(w.b, int64(count), 10)
w.b = append(w.b, '\r', '\n') w.b = append(w.b, '\r', '\n')
} }
// WriteBulk writes bulk bytes to the client. // WriteBulk writes bulk bytes to the client.
func (w *Writer) WriteBulk(bulk []byte) { func (w *Writer) WriteBulk(bulk []byte) {
w.b = append(w.b, '$') w.b = append(w.b, '$')
w.b = append(w.b, strconv.FormatInt(int64(len(bulk)), 10)...) w.b = strconv.AppendInt(w.b, int64(len(bulk)), 10)
w.b = append(w.b, '\r', '\n') w.b = append(w.b, '\r', '\n')
w.b = append(w.b, bulk...) w.b = append(w.b, bulk...)
w.b = append(w.b, '\r', '\n') w.b = append(w.b, '\r', '\n')
@ -440,7 +440,7 @@ func (w *Writer) WriteBulk(bulk []byte) {
// WriteBulkString writes a bulk string to the client. // WriteBulkString writes a bulk string to the client.
func (w *Writer) WriteBulkString(bulk string) { func (w *Writer) WriteBulkString(bulk string) {
w.b = append(w.b, '$') w.b = append(w.b, '$')
w.b = append(w.b, strconv.FormatInt(int64(len(bulk)), 10)...) w.b = strconv.AppendInt(w.b, int64(len(bulk)), 10)
w.b = append(w.b, '\r', '\n') w.b = append(w.b, '\r', '\n')
w.b = append(w.b, bulk...) w.b = append(w.b, bulk...)
w.b = append(w.b, '\r', '\n') w.b = append(w.b, '\r', '\n')
@ -493,7 +493,7 @@ func (w *Writer) WriteInt(num int) {
// WriteInt64 writes a 64-bit signed integer to the client. // WriteInt64 writes a 64-bit signed integer to the client.
func (w *Writer) WriteInt64(num int64) { func (w *Writer) WriteInt64(num int64) {
w.b = append(w.b, ':') w.b = append(w.b, ':')
w.b = append(w.b, []byte(strconv.FormatInt(num, 10))...) w.b = strconv.AppendInt(w.b, num, 10)
w.b = append(w.b, '\r', '\n') w.b = append(w.b, '\r', '\n')
} }