mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-19 05:17:30 +08:00
Add ParseRedisURI helper function
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package asynq_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -76,3 +77,19 @@ func ExampleServer_Quiet() {
|
||||
|
||||
srv.Stop()
|
||||
}
|
||||
|
||||
func ExampleParseRedisURI() {
|
||||
rconn, err := asynq.ParseRedisURI("redis://localhost:6379/10")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
r, ok := rconn.(asynq.RedisClientOpt)
|
||||
if !ok {
|
||||
log.Fatal("unexpected type")
|
||||
}
|
||||
fmt.Println(r.Addr)
|
||||
fmt.Println(r.DB)
|
||||
// Output:
|
||||
// localhost:6379
|
||||
// 10
|
||||
}
|
||||
|
Reference in New Issue
Block a user