pybotters.DataStore

class pybotters.DataStore(name: str | None = None, keys: list[str] | None = None, data: list[Dict[str, Any]] | None = None)

Abstract DataStore class.

Methods

__init__([name, keys, data])

find([query])

DataStore から Item のリストを取得します。

get(item)

DataStore から Item を取得します。

wait()

DataStore にデータの変更があるまで待機します。

watch()

DataStore の更新データをストリームします。

find(query: Dict[str, Any] | None = None) list[Dict[str, Any]]

DataStore から Item のリストを取得します。

パラメータ:

query -- DataStore をフィルタするクエリ辞書

戻り値:

クエリの指定がなければ全件データを返します。 クエリの指定があれば、それに一致するデータを返します

get(item: Dict[str, Any]) Dict[str, Any] | None

DataStore から Item を取得します。

パラメータ:

item -- DataStore のキー (DataStore._KES) を指定する辞書

戻り値:

キーに一致するアイテムがあればそのアイテムを返します。 なければ None を返します

async wait() None

DataStore にデータの変更があるまで待機します。

Usage example: wait

watch() StoreStream

DataStore の更新データをストリームします。

Usage example: watch