python_arango_ogm.db.pao_indexes

 1from enum import StrEnum, auto
 2from typing import Union, Sequence
 3
 4
 5class IndexTypeEnum(StrEnum):
 6    """
 7    Field Type Enum, used to specify field type in certain situations:
 8    """
 9    HASH = auto()
10    INVERTED = auto()
11    GEO = auto()
12    TTL = auto()
13
14
15class Index:
16    def __init__(self, fields: Union[Sequence[str], dict[str: any]], index_type: IndexTypeEnum, name, unique=False, expiry_seconds=None):
17        self.fields = fields
18        self.index_type = index_type
19        self.name = name
20        self.expiry_seconds = expiry_seconds
21        self.unique = unique
22        if index_type == IndexTypeEnum.INVERTED and (len(fields) < 2 or not isinstance(fields, dict)):
23            raise ValueError('INVERTED indexes must have at least 2 fields in a dictinoary.')
24        elif index_type == IndexTypeEnum.TTL and expiry_seconds is None:
25            raise ValueError('TTL indexes must also have expiry seconds')
class IndexTypeEnum(enum.StrEnum):
 6class IndexTypeEnum(StrEnum):
 7    """
 8    Field Type Enum, used to specify field type in certain situations:
 9    """
10    HASH = auto()
11    INVERTED = auto()
12    GEO = auto()
13    TTL = auto()

Field Type Enum, used to specify field type in certain situations:

HASH = <IndexTypeEnum.HASH: 'hash'>
INVERTED = <IndexTypeEnum.INVERTED: 'inverted'>
GEO = <IndexTypeEnum.GEO: 'geo'>
TTL = <IndexTypeEnum.TTL: 'ttl'>
Inherited Members
enum.Enum
name
value
builtins.str
encode
replace
split
rsplit
join
capitalize
casefold
title
center
count
expandtabs
find
partition
index
ljust
lower
lstrip
rfind
rindex
rjust
rstrip
rpartition
splitlines
strip
swapcase
translate
upper
startswith
endswith
removeprefix
removesuffix
isascii
islower
isupper
istitle
isspace
isdecimal
isdigit
isnumeric
isalpha
isalnum
isidentifier
isprintable
zfill
format
format_map
maketrans
class Index:
16class Index:
17    def __init__(self, fields: Union[Sequence[str], dict[str: any]], index_type: IndexTypeEnum, name, unique=False, expiry_seconds=None):
18        self.fields = fields
19        self.index_type = index_type
20        self.name = name
21        self.expiry_seconds = expiry_seconds
22        self.unique = unique
23        if index_type == IndexTypeEnum.INVERTED and (len(fields) < 2 or not isinstance(fields, dict)):
24            raise ValueError('INVERTED indexes must have at least 2 fields in a dictinoary.')
25        elif index_type == IndexTypeEnum.TTL and expiry_seconds is None:
26            raise ValueError('TTL indexes must also have expiry seconds')
Index( fields: Union[Sequence[str], dict[slice(<class 'str'>, <built-in function any>, None)]], index_type: IndexTypeEnum, name, unique=False, expiry_seconds=None)
17    def __init__(self, fields: Union[Sequence[str], dict[str: any]], index_type: IndexTypeEnum, name, unique=False, expiry_seconds=None):
18        self.fields = fields
19        self.index_type = index_type
20        self.name = name
21        self.expiry_seconds = expiry_seconds
22        self.unique = unique
23        if index_type == IndexTypeEnum.INVERTED and (len(fields) < 2 or not isinstance(fields, dict)):
24            raise ValueError('INVERTED indexes must have at least 2 fields in a dictinoary.')
25        elif index_type == IndexTypeEnum.TTL and expiry_seconds is None:
26            raise ValueError('TTL indexes must also have expiry seconds')
fields
index_type
name
expiry_seconds
unique