Browse Source

Improve documentation.

Gary Burd 13 years ago
parent
commit
c03f49932f
2 changed files with 15 additions and 1 deletions
  1. 1 1
      redis/conn.go
  2. 14 0
      redis/doc.go

+ 1 - 1
redis/conn.go

@@ -55,7 +55,7 @@ func Dial(network, address string) (Conn, error) {
 }
 
 // DialTimeout acts like Dial but takes timeouts for establishing the
-// connection to the server, write a command and reading a reply.
+// connection to the server, writing a command and reading a reply.
 func DialTimeout(network, address string, connectTimeout, readTimeout, writeTimeout time.Duration) (Conn, error) {
 	var c net.Conn
 	var err error

+ 14 - 0
redis/doc.go

@@ -121,4 +121,18 @@
 //      case error:
 //          return v
 //  }
+//
+// Reply Helpers
+//
+// The Bool, Int, Bytes, String and MultiBulk functions convert a reply to a
+// value of a specific type. To allow convenient wrapping of calls to the
+// connection Do and Receive methods, the functions take a second argument of
+// type error. If the error is non-nil, then the helper function returns the
+// error. If the error is nil, the function converts the reply to the specified
+// type:
+//
+//  exists, err := redis.Bool(c.Do("EXISTS", "foo"))
+//  if err != nil {
+//      // handle error return from c.Do or type conversion error.
+//  }
 package redis