()
| 774 | } |
| 775 | |
| 776 | func ExampleClient_timeseries_aggmulti() { |
| 777 | ctx := context.Background() |
| 778 | |
| 779 | rdb := redis.NewClient(&redis.Options{ |
| 780 | Addr: "localhost:6379", |
| 781 | Password: "", // no password set |
| 782 | DB: 0, // use default DB |
| 783 | }) |
| 784 | |
| 785 | // REMOVE_START |
| 786 | // make sure we are working with fresh database |
| 787 | rdb.FlushDB(ctx) |
| 788 | rdb.Del(ctx, "wind:1", "wind:2", "wind:3", "wind:4") |
| 789 | // REMOVE_END |
| 790 | |
| 791 | // STEP_START agg_multi |
| 792 | res37, err := rdb.TSCreateWithArgs(ctx, "wind:1", &redis.TSOptions{ |
| 793 | Labels: map[string]string{"country": "uk"}, |
| 794 | }).Result() |
| 795 | if err != nil { |
| 796 | panic(err) |
| 797 | } |
| 798 | |
| 799 | fmt.Println(res37) // >>> OK |
| 800 | |
| 801 | res38, err := rdb.TSCreateWithArgs(ctx, "wind:2", &redis.TSOptions{ |
| 802 | Labels: map[string]string{"country": "uk"}, |
| 803 | }).Result() |
| 804 | if err != nil { |
| 805 | panic(err) |
| 806 | } |
| 807 | |
| 808 | fmt.Println(res38) // >>> OK |
| 809 | |
| 810 | res39, err := rdb.TSCreateWithArgs(ctx, "wind:3", &redis.TSOptions{ |
| 811 | Labels: map[string]string{"country": "us"}, |
| 812 | }).Result() |
| 813 | if err != nil { |
| 814 | panic(err) |
| 815 | } |
| 816 | |
| 817 | fmt.Println(res39) // >>> OK |
| 818 | |
| 819 | res40, err := rdb.TSCreateWithArgs(ctx, "wind:4", &redis.TSOptions{ |
| 820 | Labels: map[string]string{"country": "us"}, |
| 821 | }).Result() |
| 822 | if err != nil { |
| 823 | panic(err) |
| 824 | } |
| 825 | |
| 826 | fmt.Println(res40) // >>> OK |
| 827 | |
| 828 | res41, err := rdb.TSMAdd(ctx, [][]interface{}{ |
| 829 | {"wind:1", 1, 12}, |
| 830 | {"wind:2", 1, 18}, |
| 831 | {"wind:3", 1, 5}, |
| 832 | {"wind:4", 1, 20}, |
| 833 | }).Result() |
nothing calls this directly
no test coverage detected