MCPcopy
hub / github.com/redis/go-redis / Example_customCommand

Function Example_customCommand

example_test.go:615–625  ·  example_test.go::Example_customCommand
()

Source from the content-addressed store, hash-verified

613}
614
615func Example_customCommand() {
616 Get := func(ctx context.Context, rdb *redis.Client, key string) *redis.StringCmd {
617 cmd := redis.NewStringCmd(ctx, "get", key)
618 rdb.Process(ctx, cmd)
619 return cmd
620 }
621
622 v, err := Get(ctx, rdb, "key_does_not_exist").Result()
623 fmt.Printf("%q %s", v, err)
624 // Output: "" redis: nil
625}
626
627func Example_customCommand2() {
628 v, err := rdb.Do(ctx, "get", "key_does_not_exist").Text()

Callers

nothing calls this directly

Calls 3

ProcessMethod · 0.65
ResultMethod · 0.65
PrintfMethod · 0.65

Tested by

no test coverage detected