Added MongoStorage for FSM

This commit is contained in:
Rishat Fayzullin 2024-03-06 22:45:09 +03:00
parent 329c7f4c97
commit a5ccf28498
11 changed files with 312 additions and 102 deletions

View file

@ -78,13 +78,13 @@ Linux / macOS:
.. code-block:: bash
pip install -e ."[dev,test,docs,fast,redis,proxy,i18n]"
pip install -e ."[dev,test,docs,fast,redis,mongo,proxy,i18n]"
Windows:
.. code-block:: bash
pip install -e .[dev,test,docs,fast,redis,proxy,i18n]
pip install -e .[dev,test,docs,fast,redis,mongo,proxy,i18n]
It will install :code:`aiogram` in editable mode into your virtual environment and all dependencies.
@ -116,11 +116,12 @@ All changes should be tested:
pytest tests
Also if you are doing something with Redis-storage, you will need to test everything works with Redis:
Also if you are doing something with Redis-storage or/and MongoDB-storage,
you will need to test everything works with Redis or/and MongoDB:
.. code-block:: bash
pytest --redis redis://<host>:<port>/<db> tests
pytest --redis redis://<host>:<port>/<db> --mongo mongodb://<user>:<password>@<host>:<port> tests
Docs
----

View file

@ -19,13 +19,23 @@ RedisStorage
:members: __init__, from_url
:member-order: bysource
Keys inside storage can be customized via key builders:
MongoStorage
------------
.. autoclass:: aiogram.fsm.storage.redis.KeyBuilder
.. autoclass:: aiogram.fsm.storage.mongo.MongoStorage
:members: __init__, from_url
:member-order: bysource
KeyBuilder
------------
Keys inside Redis and Mongo storages can be customized via key builders:
.. autoclass:: aiogram.fsm.storage.base.KeyBuilder
:members:
:member-order: bysource
.. autoclass:: aiogram.fsm.storage.redis.DefaultKeyBuilder
.. autoclass:: aiogram.fsm.storage.base.DefaultKeyBuilder
:members:
:member-order: bysource