webhook_telegram_bot.database.backends.base

This file contains base classes for database layer.

Module Contents

Classes

BaseDatabaseWrapper

Represent abstract database layer.

class webhook_telegram_bot.database.backends.base.BaseDatabaseWrapper(url: str)

Bases: abc.ABC

Represent abstract database layer.

connection
closed = False
abstract close(self) None

Close database connection.

Returns

abstract async drop_database(self) None

Drop database.

Returns

abstract async get_chat_by_chat_id(self, chat_id: int) webhook_telegram_bot.database.models.Chat

Return chat by id.

Parameters

chat_id – chat identification number

Returns

abstract async get_chat_by_webhook_id(self, webhook_id: str) webhook_telegram_bot.database.models.Chat

Return chat by webhook id.

Parameters

webhook_id – webhook identification string

Returns

Chat instance

abstract async save_chat(self, chat: webhook_telegram_bot.database.models.Chat) webhook_telegram_bot.database.models.Chat

Save chat object to database.

Parameters

chat – Chat instance

Returns

Chat instance