Skip to content

glide_shared.commands.command_args

Limit

Represents a limit argument for range queries in various commands.

The LIMIT argument is commonly used to specify a subset of results from the matching elements, similar to the LIMIT clause in SQL (e.g., SELECT LIMIT offset, count).

This class can be utilized in multiple commands that support limit options, such as ZRANGE, SORT and others.

Parameters:

Name Type Description Default
offset int

The starting position of the range, zero based.

required
count int

The maximum number of elements to include in the range. A negative count returns all elements from the offset.

required

Examples:

>>> limit = Limit(0, 10)  # Fetch the first 10 elements
>>> limit = Limit(5, -1)  # Fetch all elements starting from the 5th element
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Limit:
    """
    Represents a limit argument for range queries in various commands.

    The `LIMIT` argument is commonly used to specify a subset of results from the matching elements,
    similar to the `LIMIT` clause in SQL (e.g., `SELECT LIMIT offset, count`).

    This class can be utilized in multiple commands that support limit options,
    such as [ZRANGE](https://valkey.io/commands/zrange), [SORT](https://valkey.io/commands/sort/) and others.

    Args:
        offset (int): The starting position of the range, zero based.
        count (int): The maximum number of elements to include in the range.
            A negative count returns all elements from the offset.

    Examples:
        >>> limit = Limit(0, 10)  # Fetch the first 10 elements
        >>> limit = Limit(5, -1)  # Fetch all elements starting from the 5th element
    """

    def __init__(self, offset: int, count: int):
        self.offset = offset
        self.count = count

OrderBy

Bases: Enum

Enumeration representing sorting order options.

This enum is used for the following commands:

- `SORT`: General sorting in ascending or descending order.
- `GEOSEARCH`: Sorting items based on their proximity to a center point.
- `FT.AGGREGATE`: Used in the SortBy clause of the FT.AGGREGATE command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class OrderBy(Enum):
    """
    Enumeration representing sorting order options.

    This enum is used for the following commands:

        - `SORT`: General sorting in ascending or descending order.
        - `GEOSEARCH`: Sorting items based on their proximity to a center point.
        - `FT.AGGREGATE`: Used in the SortBy clause of the FT.AGGREGATE command.

    """

    ASC = "ASC"
    """
    ASC: Sort in ascending order.
    """

    DESC = "DESC"
    """
    DESC: Sort in descending order.
    """

ASC = 'ASC' class-attribute instance-attribute

ASC: Sort in ascending order.

DESC = 'DESC' class-attribute instance-attribute

DESC: Sort in descending order.

ListDirection

Bases: Enum

Enumeration representing element popping or adding direction for List commands.

Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class ListDirection(Enum):
    """
    Enumeration representing element popping or adding direction for List commands.
    """

    LEFT = "LEFT"
    """
    LEFT: Represents the option that elements should be popped from or added to the left side of a list.
    """

    RIGHT = "RIGHT"
    """
    RIGHT: Represents the option that elements should be popped from or added to the right side of a list.
    """

LEFT = 'LEFT' class-attribute instance-attribute

LEFT: Represents the option that elements should be popped from or added to the left side of a list.

RIGHT = 'RIGHT' class-attribute instance-attribute

RIGHT: Represents the option that elements should be popped from or added to the right side of a list.

ObjectType

Bases: Enum

Enumeration representing the data types supported by the database.

Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/command_args.py
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
class ObjectType(Enum):
    """
    Enumeration representing the data types supported by the database.
    """

    STRING = "String"
    """
    Represents a string data type.
    """

    LIST = "List"
    """
    Represents a list data type.
    """

    SET = "Set"
    """
    Represents a set data type.
    """

    ZSET = "ZSet"
    """
    Represents a sorted set data type.
    """

    HASH = "Hash"
    """
    Represents a hash data type.
    """

    STREAM = "Stream"
    """
    Represents a stream data type.
    """

STRING = 'String' class-attribute instance-attribute

Represents a string data type.

LIST = 'List' class-attribute instance-attribute

Represents a list data type.

SET = 'Set' class-attribute instance-attribute

Represents a set data type.

ZSET = 'ZSet' class-attribute instance-attribute

Represents a sorted set data type.

HASH = 'Hash' class-attribute instance-attribute

Represents a hash data type.

STREAM = 'Stream' class-attribute instance-attribute

Represents a stream data type.