| 740 | } |
| 741 | |
| 742 | func 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 | |
| 775 | func ExampleClient_get2mtnbikes() { |
| 776 | ctx := context.Background() |