Init SQLite implementation of DataBase interface

- Init db.py
- Add SQLiteEngine class
- Add SQLite class
This commit is contained in:
trueold89 2024-07-20 12:13:44 +03:00
parent 3d078ab2b3
commit 272a574aef
Signed by: trueold89
GPG Key ID: C122E85DD49E6B30
1 changed files with 63 additions and 0 deletions

63
openbookr/db.py Normal file
View File

@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
from typing import Iterable
##################
# DataBase logic #
##################
from openbookr.ABC import IDataBase
from openbookr.models import Book
class SQLiteEngine(object):
...
class SQlite(IDataBase, SQLiteEngine):
async def authors(self) -> Iterable:
...
async def genres(self) -> Iterable:
...
async def tags(self) -> Iterable:
...
async def add_book(self, book: Book) -> None:
...
async def get_book(self, book_id: int) -> Book:
...
async def del_book(self, book_id: int) -> None:
...
async def update_book(self, book_id: int, updated_book: Book) -> None:
...
async def book_list(
self,
author: str | None = None,
tags: Iterable | None = None,
genres: Iterable | None = None,
) -> Iterable:
...
async def add_genre(self, genre: str) -> None:
...
async def add_tag(self, tag: str) -> None:
...
async def del_genre(self, genre_id: int) -> None:
...
async def del_tag(self, tag_id: int) -> None:
...
async def add_author(self, author: str) -> None:
...
async def del_author(self, author_id: int) -> None:
...