|
2 | 2 |
|
3 | 3 | package api |
4 | 4 |
|
| 5 | +import "github.com/valkey-io/valkey-glide/go/glide/api/options" |
| 6 | + |
5 | 7 | // Supports commands and transactions for the "Generic Commands" group for standalone and cluster clients. |
6 | 8 | // |
7 | 9 | // See [valkey.io] for details. |
@@ -527,4 +529,180 @@ type GenericBaseCommands interface { |
527 | 529 | // |
528 | 530 | // [valkey.io]: https://valkey.io/commands/dump/ |
529 | 531 | Dump(key string) (Result[string], error) |
| 532 | + |
| 533 | + ObjectFreq(key string) (Result[int64], error) |
| 534 | + |
| 535 | + ObjectIdleTime(key string) (Result[int64], error) |
| 536 | + |
| 537 | + ObjectRefCount(key string) (Result[int64], error) |
| 538 | + |
| 539 | + // Sorts the elements in the list, set, or sorted set at key and returns the result. |
| 540 | + // The sort command can be used to sort elements based on different criteria and apply |
| 541 | + // transformations on sorted elements. |
| 542 | + // To store the result into a new key, see the sortStore function. |
| 543 | + // |
| 544 | + // Parameters: |
| 545 | + // key - The key of the list, set, or sorted set to be sorted. |
| 546 | + // |
| 547 | + // Return value: |
| 548 | + // An Array of sorted elements. |
| 549 | + // |
| 550 | + // Example: |
| 551 | + // |
| 552 | + // result, err := client.Sort("key") |
| 553 | + // result.Value(): [{1 false} {2 false} {3 false}] |
| 554 | + // result.IsNil(): false |
| 555 | + // |
| 556 | + // [valkey.io]: https://valkey.io/commands/sort/ |
| 557 | + Sort(key string) ([]Result[string], error) |
| 558 | + |
| 559 | + // Sorts the elements in the list, set, or sorted set at key and returns the result. |
| 560 | + // The sort command can be used to sort elements based on different criteria and apply |
| 561 | + // transformations on sorted elements. |
| 562 | + // To store the result into a new key, see the sortStore function. |
| 563 | + // |
| 564 | + // Note: |
| 565 | + // In cluster mode, if `key` map to different hash slots, the command |
| 566 | + // will be split across these slots and executed separately for each. This means the command |
| 567 | + // is atomic only at the slot level. If one or more slot-specific requests fail, the entire |
| 568 | + // call will return the first encountered error, even though some requests may have succeeded |
| 569 | + // while others did not. If this behavior impacts your application logic, consider splitting |
| 570 | + // the request into sub-requests per slot to ensure atomicity. |
| 571 | + // The use of SortOptions.byPattern and SortOptions.getPatterns in cluster mode is |
| 572 | + // supported since Valkey version 8.0. |
| 573 | + // |
| 574 | + // Parameters: |
| 575 | + // key - The key of the list, set, or sorted set to be sorted. |
| 576 | + // sortOptions - The SortOptions type. |
| 577 | + // |
| 578 | + // Return value: |
| 579 | + // An Array of sorted elements. |
| 580 | + // |
| 581 | + // Example: |
| 582 | + // |
| 583 | + // options := api.NewSortOptions().SetByPattern("weight_*").SetIsAlpha(false).AddGetPattern("object_*").AddGetPattern("#") |
| 584 | + // result, err := client.Sort("key", options) |
| 585 | + // result.Value(): [{Object_3 false} {c false} {Object_1 false} {a false} {Object_2 false} {b false}] |
| 586 | + // result.IsNil(): false |
| 587 | + // |
| 588 | + // [valkey.io]: https://valkey.io/commands/sort/ |
| 589 | + SortWithOptions(key string, sortOptions *options.SortOptions) ([]Result[string], error) |
| 590 | + |
| 591 | + // Sorts the elements in the list, set, or sorted set at key and stores the result in |
| 592 | + // destination. The sort command can be used to sort elements based on |
| 593 | + // different criteria, apply transformations on sorted elements, and store the result in a new key. |
| 594 | + // The sort command can be used to sort elements based on different criteria and apply |
| 595 | + // transformations on sorted elements. |
| 596 | + // To get the sort result without storing it into a key, see the sort or sortReadOnly function. |
| 597 | + // |
| 598 | + // Note: |
| 599 | + // In cluster mode, if `key` and `destination` map to different hash slots, the command |
| 600 | + // will be split across these slots and executed separately for each. This means the command |
| 601 | + // is atomic only at the slot level. If one or more slot-specific requests fail, the entire |
| 602 | + // call will return the first encountered error, even though some requests may have succeeded |
| 603 | + // while others did not. If this behavior impacts your application logic, consider splitting |
| 604 | + // the request into sub-requests per slot to ensure atomicity. |
| 605 | + // |
| 606 | + // Parameters: |
| 607 | + // key - The key of the list, set, or sorted set to be sorted. |
| 608 | + // destination - The key where the sorted result will be stored. |
| 609 | + // |
| 610 | + // Return value: |
| 611 | + // The number of elements in the sorted key stored at destination. |
| 612 | + // |
| 613 | + // Example: |
| 614 | + // |
| 615 | + // result, err := client.SortStore("key","destkey") |
| 616 | + // result.Value(): 1 |
| 617 | + // result.IsNil(): false |
| 618 | + // |
| 619 | + // [valkey.io]: https://valkey.io/commands/sort/ |
| 620 | + SortStore(key string, destination string) (Result[int64], error) |
| 621 | + |
| 622 | + // Sorts the elements in the list, set, or sorted set at key and stores the result in |
| 623 | + // destination. The sort command can be used to sort elements based on |
| 624 | + // different criteria, apply transformations on sorted elements, and store the result in a new key. |
| 625 | + // The sort command can be used to sort elements based on different criteria and apply |
| 626 | + // transformations on sorted elements. |
| 627 | + // To get the sort result without storing it into a key, see the sort or sortReadOnly function. |
| 628 | + // |
| 629 | + // Note: |
| 630 | + // In cluster mode, if `key` and `destination` map to different hash slots, the command |
| 631 | + // will be split across these slots and executed separately for each. This means the command |
| 632 | + // is atomic only at the slot level. If one or more slot-specific requests fail, the entire |
| 633 | + // call will return the first encountered error, even though some requests may have succeeded |
| 634 | + // while others did not. If this behavior impacts your application logic, consider splitting |
| 635 | + // the request into sub-requests per slot to ensure atomicity. |
| 636 | + // The use of SortOptions.byPattern and SortOptions.getPatterns |
| 637 | + // in cluster mode is supported since Valkey version 8.0. |
| 638 | + // |
| 639 | + // Parameters: |
| 640 | + // key - The key of the list, set, or sorted set to be sorted. |
| 641 | + // destination - The key where the sorted result will be stored. |
| 642 | + // sortOptions - The SortOptions type. |
| 643 | + // |
| 644 | + // Return value: |
| 645 | + // The number of elements in the sorted key stored at destination. |
| 646 | + // |
| 647 | + // Example: |
| 648 | + // |
| 649 | + // options := api.NewSortOptions().SetByPattern("weight_*").SetIsAlpha(false).AddGetPattern("object_*").AddGetPattern("#") |
| 650 | + // result, err := client.SortStore("key","destkey",options) |
| 651 | + // result.Value(): 1 |
| 652 | + // result.IsNil(): false |
| 653 | + // |
| 654 | + // [valkey.io]: https://valkey.io/commands/sort/ |
| 655 | + SortStoreWithOptions(key string, destination string, sortOptions *options.SortOptions) (Result[int64], error) |
| 656 | + |
| 657 | + // Sorts the elements in the list, set, or sorted set at key and returns the result. |
| 658 | + // The sortReadOnly command can be used to sort elements based on different criteria and apply |
| 659 | + // transformations on sorted elements. |
| 660 | + // This command is routed depending on the client's ReadFrom strategy. |
| 661 | + // |
| 662 | + // Parameters: |
| 663 | + // key - The key of the list, set, or sorted set to be sorted. |
| 664 | + // |
| 665 | + // Return value: |
| 666 | + // An Array of sorted elements. |
| 667 | + // |
| 668 | + // Example: |
| 669 | + // |
| 670 | + // result, err := client.SortReadOnly("key") |
| 671 | + // result.Value(): [{1 false} {2 false} {3 false}] |
| 672 | + // result.IsNil(): false |
| 673 | + // |
| 674 | + // [valkey.io]: https://valkey.io/commands/sort/ |
| 675 | + SortReadOnly(key string) ([]Result[string], error) |
| 676 | + |
| 677 | + // Sorts the elements in the list, set, or sorted set at key and returns the result. |
| 678 | + // The sort command can be used to sort elements based on different criteria and apply |
| 679 | + // transformations on sorted elements. |
| 680 | + // This command is routed depending on the client's ReadFrom strategy. |
| 681 | + // |
| 682 | + // Note: |
| 683 | + // In cluster mode, if `key` map to different hash slots, the command |
| 684 | + // will be split across these slots and executed separately for each. This means the command |
| 685 | + // is atomic only at the slot level. If one or more slot-specific requests fail, the entire |
| 686 | + // call will return the first encountered error, even though some requests may have succeeded |
| 687 | + // while others did not. If this behavior impacts your application logic, consider splitting |
| 688 | + // the request into sub-requests per slot to ensure atomicity. |
| 689 | + // The use of SortOptions.byPattern and SortOptions.getPatterns in cluster mode is |
| 690 | + // supported since Valkey version 8.0. |
| 691 | + // |
| 692 | + // Parameters: |
| 693 | + // key - The key of the list, set, or sorted set to be sorted. |
| 694 | + // sortOptions - The SortOptions type. |
| 695 | + // |
| 696 | + // Return value: |
| 697 | + // An Array of sorted elements. |
| 698 | + // |
| 699 | + // Example: |
| 700 | + // |
| 701 | + // options := api.NewSortOptions().SetByPattern("weight_*").SetIsAlpha(false).AddGetPattern("object_*").AddGetPattern("#") |
| 702 | + // result, err := client.SortReadOnly("key", options) |
| 703 | + // result.Value(): [{Object_3 false} {c false} {Object_1 false} {a false} {Object_2 false} {b false}] |
| 704 | + // result.IsNil(): false |
| 705 | + // |
| 706 | + // [valkey.io]: https://valkey.io/commands/sort/ |
| 707 | + SortReadOnlyWithOptions(key string, sortOptions *options.SortOptions) ([]Result[string], error) |
530 | 708 | } |
0 commit comments