()
| 477 | } |
| 478 | |
| 479 | func ExampleClient_xgroupcreate() { |
| 480 | ctx := context.Background() |
| 481 | |
| 482 | rdb := redis.NewClient(&redis.Options{ |
| 483 | Addr: "localhost:6379", |
| 484 | Password: "", // no password docs |
| 485 | DB: 0, // use default DB |
| 486 | }) |
| 487 | |
| 488 | // REMOVE_START |
| 489 | // start with fresh database |
| 490 | rdb.FlushDB(ctx) |
| 491 | rdb.Del(ctx, "race:france") |
| 492 | // REMOVE_END |
| 493 | |
| 494 | _, err := rdb.XAdd(ctx, &redis.XAddArgs{ |
| 495 | Stream: "race:france", |
| 496 | Values: map[string]interface{}{ |
| 497 | "rider": "Castilla", |
| 498 | "speed": 30.2, |
| 499 | "position": 1, |
| 500 | "location_id": 1, |
| 501 | }, |
| 502 | ID: "1692632086370-0", |
| 503 | }).Result() |
| 504 | |
| 505 | if err != nil { |
| 506 | panic(err) |
| 507 | } |
| 508 | |
| 509 | // STEP_START xgroup_create |
| 510 | res19, err := rdb.XGroupCreate(ctx, "race:france", "france_riders", "$").Result() |
| 511 | |
| 512 | if err != nil { |
| 513 | panic(err) |
| 514 | } |
| 515 | |
| 516 | fmt.Println(res19) // >>> OK |
| 517 | // STEP_END |
| 518 | |
| 519 | // Output: |
| 520 | // OK |
| 521 | } |
| 522 | |
| 523 | func ExampleClient_xgroupcreatemkstream() { |
| 524 | ctx := context.Background() |
nothing calls this directly
no test coverage detected