浏览代码

Add Dial example.

Gary Burd 13 年之前
父节点
当前提交
f885f172c9
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      redis/conn_test.go

+ 10 - 0
redis/conn_test.go

@@ -303,3 +303,13 @@ func TestError(t *testing.T) {
 		t.Errorf("Do(SET, key, val) returned error %v, expected nil.", err)
 	}
 }
+
+// Connect to local instance of Redis running on the default port.
+func ExampleDial(x int) {
+	c, err := redis.Dial("tcp", ":6379")
+	if err != nil {
+		// handle error
+	}
+	defer c.Close()
+
+}