30 lines
694 B
Python
30 lines
694 B
Python
|
from backend.model.tribe import Tribe
|
||
|
from backend.repository.abstract_repository import AbstractRepository
|
||
|
|
||
|
|
||
|
class TribeSQLiteRepository(AbstractRepository):
|
||
|
def __init__(self, conn) -> None:
|
||
|
self.conn = conn
|
||
|
|
||
|
def add(self, tribe: Tribe) -> None:
|
||
|
pass
|
||
|
|
||
|
def update(self, name: str, tribe: Tribe) -> None:
|
||
|
pass
|
||
|
|
||
|
def get(self, name: str) -> Tribe:
|
||
|
pass
|
||
|
|
||
|
def list(self) -> list[Tribe]:
|
||
|
cursor = self.conn.cursor()
|
||
|
cursor.execute(
|
||
|
"""
|
||
|
SELECT * FROM tribes
|
||
|
"""
|
||
|
)
|
||
|
rows = cursor.fetchall()
|
||
|
return [Tribe(*r) for r in rows]
|
||
|
|
||
|
def delete(self, tribe: Tribe) -> None:
|
||
|
pass
|