MCPcopy Index your code
hub / github.com/redis/go-redis / ExampleClient_getmodels

Function ExampleClient_getmodels

doctests/json_tutorial_test.go:742–773  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

740}
741
742func ExampleClient_getmodels() {
743 ctx := context.Background()
744
745 rdb := redis.NewClient(&redis.Options{
746 Addr: "localhost:6379",
747 Password: "", // no password docs
748 DB: 0, // use default DB
749 })
750
751 // REMOVE_START
752 rdb.Del(ctx, "bikes:inventory")
753 // REMOVE_END
754
755 _, err := rdb.JSONSet(ctx, "bikes:inventory", "$", inventory_json).Result()
756
757 if err != nil {
758 panic(err)
759 }
760
761 // STEP_START get_models
762 res6, err := rdb.JSONGet(ctx, "bikes:inventory", "$..model").Result()
763
764 if err != nil {
765 panic(err)
766 }
767
768 fmt.Println(res6) // >>> ["Salacia","Mimas","Phoebe","Quaoar","Weywot"]
769 // STEP_END
770
771 // Output:
772 // ["Salacia","Mimas","Phoebe","Quaoar","Weywot"]
773}
774
775func ExampleClient_get2mtnbikes() {
776 ctx := context.Background()

Callers

nothing calls this directly

Calls 4

DelMethod · 0.65
ResultMethod · 0.65
JSONSetMethod · 0.65
JSONGetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…