1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Add StringCmd helpers.

This commit is contained in:
Vladimir Mihailenco
2014-07-31 15:18:23 +03:00
parent ffe62d60e2
commit 9ac69a08db
3 changed files with 52 additions and 5 deletions

View File

@ -40,14 +40,23 @@ func ExampleNewFailoverClient() {
}
func ExampleClient() {
set := client.Set("foo", "bar")
fmt.Println(set.Err())
if err := client.Set("foo", "bar").Err(); err != nil {
panic(err)
}
v, err := client.Get("hello").Result()
fmt.Printf("%q %s %v", v, err, err == redis.Nil)
fmt.Printf("%q %q %v", v, err, err == redis.Nil)
// Output: "" "redis: nil" true
}
// Output: <nil>
// "" redis: nil true
func ExampleClient_Incr() {
if err := client.Incr("counter").Err(); err != nil {
panic(err)
}
n, err := client.Get("counter").Int64()
fmt.Println(n, err)
// Output: 1 <nil>
}
func ExampleClient_Pipelined() {