Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Abstract away database operations from Cogs #10

Open
freepizzas-dev opened this issue Sep 14, 2023 · 0 comments
Open

Abstract away database operations from Cogs #10

freepizzas-dev opened this issue Sep 14, 2023 · 0 comments

Comments

@freepizzas-dev
Copy link
Owner

freepizzas-dev commented Sep 14, 2023

Expose bot.db_read() and bot.db_store() operations to Cogs that abstract away dealing with any sort of SQL operations. Have the bot DB functions handle connections and commits, as well as exceptions.

The calling Cog's name can be used to define tables or databases to keep data segregated both per-guild and per-module.

If Cogs need to perform complex transactions on the DB for consistency reasons, a lock can be exposed through the bot as well. But a short default timeout should be implented and signaled (configurable through onebot_config).

Meanwhile, this refactor can be used as an opportunity to switch to an async sqlite implementation. (Issue #5)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant