From 4380ff9799eb138c5ecbc3787781bd9c37580da2 Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Thu, 22 Sep 2016 13:11:27 -0700 Subject: [PATCH] write raw data --- redcon.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/redcon.go b/redcon.go index bd3c81e..dcf070a 100644 --- a/redcon.go +++ b/redcon.go @@ -53,6 +53,8 @@ type Conn interface { WriteArray(count int) // WriteNull writes a null to the client WriteNull() + // WriteRaw writes raw data to the client. + WriteRaw(data []byte) // Context returns a user-defined context Context() interface{} // SetContext sets a user-defined context @@ -259,6 +261,7 @@ func (c *conn) WriteInt(num int) { c.wr.WriteInt(num) } func (c *conn) WriteError(msg string) { c.wr.WriteError(msg) } func (c *conn) WriteArray(count int) { c.wr.WriteArray(count) } func (c *conn) WriteNull() { c.wr.WriteNull() } +func (c *conn) WriteRaw(data []byte) { c.wr.WriteRaw(data) } func (c *conn) RemoteAddr() string { return c.addr } // DetachedConn represents a connection that is detached from the server @@ -405,6 +408,11 @@ func (w *Writer) WriteInt(num int) { w.b = append(w.b, '\r', '\n') } +// WriteRaw writes raw data to the client. +func (w *Writer) WriteRaw(data []byte) { + w.b = append(w.b, data...) +} + // Reader represent a reader for RESP or telnet commands. type Reader struct { rd *bufio.Reader