IndexedDB#
This CDP domain is experimental.
Types#
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
- class DatabaseWithObjectStores(name, version, object_stores)[source]#
Database with an array of object stores.
-
version:
float# Database version (type is not ‘integer’, as the standard requires the version number to be ‘unsigned long long’)
-
object_stores:
List[ObjectStore]# Object stores in this database.
-
version:
- class ObjectStore(name, key_path, auto_increment, indexes)[source]#
Object store.
-
indexes:
List[ObjectStoreIndex]# Indexes in this object store.
-
indexes:
- class DataEntry(key, primary_key, value)[source]#
Data entry.
-
key:
RemoteObject# Key object.
-
primary_key:
RemoteObject# Primary key object.
-
value:
RemoteObject# Value object.
-
key:
Commands#
Each command is a generator function. The return
type Generator[x, y, z] indicates that the generator
yields arguments of type x, it must be resumed with
an argument of type y, and it returns type z. In
this library, types x and y are the same for all
commands, and z is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
- clear_object_store(database_name, object_store_name, security_origin=None, storage_key=None, storage_bucket=None)[source]#
Clears all entries from an object store.
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.database_name (
str) – Database name.object_store_name (
str) – Object store name.
- Return type:
- delete_database(database_name, security_origin=None, storage_key=None, storage_bucket=None)[source]#
Deletes a database.
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.database_name (
str) – Database name.
- Return type:
- delete_object_store_entries(database_name, object_store_name, key_range, security_origin=None, storage_key=None, storage_bucket=None)[source]#
Delete a range of entries from an object store
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.database_name (
str) –object_store_name (
str) –key_range (
KeyRange) – Range of entry keys to delete
- Return type:
- get_metadata(database_name, object_store_name, security_origin=None, storage_key=None, storage_bucket=None)[source]#
Gets metadata of an object store.
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.database_name (
str) – Database name.object_store_name (
str) – Object store name.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[float,float]]- Returns:
A tuple with the following items:
entriesCount - the entries count
keyGeneratorValue - the current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true.
- request_data(database_name, object_store_name, index_name, skip_count, page_size, security_origin=None, storage_key=None, storage_bucket=None, key_range=None)[source]#
Requests data from object store or index.
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.database_name (
str) – Database name.object_store_name (
str) – Object store name.index_name (
str) – Index name, empty string for object store data requests.skip_count (
int) – Number of records to skip.page_size (
int) – Number of records to fetch.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[List[DataEntry],bool]]- Returns:
A tuple with the following items:
objectStoreDataEntries - Array of object store data entries.
hasMore - If true, there are more entries to fetch in the given range.
- request_database(database_name, security_origin=None, storage_key=None, storage_bucket=None)[source]#
Requests database with given name in given frame.
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.database_name (
str) – Database name.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],DatabaseWithObjectStores]- Returns:
Database with an array of object stores.
- request_database_names(security_origin=None, storage_key=None, storage_bucket=None)[source]#
Requests database names for given security origin.
- Parameters:
security_origin (
Optional[str]) – (Optional) At least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.storage_bucket (
Optional[StorageBucket]) – (Optional) Storage bucket. If not specified, it uses the default bucket.
- Return type:
- Returns:
Database names for origin.
Events#
There are no events in this module.