1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

Add ctx as first arg

This commit is contained in:
Vladimir Mihailenco
2020-03-11 16:26:42 +02:00
parent 64bb0b7f3a
commit f5593121e0
36 changed files with 3200 additions and 2970 deletions

View File

@ -37,7 +37,7 @@ func Example_instrumentation() {
})
rdb.AddHook(redisHook{})
rdb.Ping()
rdb.Ping(ctx)
// Output: starting processing: <ping: >
// finished processing: <ping: PONG>
}
@ -48,9 +48,9 @@ func ExamplePipeline_instrumentation() {
})
rdb.AddHook(redisHook{})
rdb.Pipelined(func(pipe redis.Pipeliner) error {
pipe.Ping()
pipe.Ping()
rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {
pipe.Ping(ctx)
pipe.Ping(ctx)
return nil
})
// Output: pipeline starting processing: [ping: ping: ]
@ -63,9 +63,9 @@ func ExampleWatch_instrumentation() {
})
rdb.AddHook(redisHook{})
rdb.Watch(func(tx *redis.Tx) error {
tx.Ping()
tx.Ping()
rdb.Watch(ctx, func(tx *redis.Tx) error {
tx.Ping(ctx)
tx.Ping(ctx)
return nil
}, "foo")
// Output: