Init SQLite implementation of DataBase interface
- Init db.py - Add SQLiteEngine class - Add SQLite class
This commit is contained in:
parent
3d078ab2b3
commit
272a574aef
|
@ -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:
|
||||||
|
...
|
Loading…
Reference in New Issue