initial commit
This commit is contained in:
19
gotify_tray/database/database.py
Normal file
19
gotify_tray/database/database.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import logging
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
from PyQt6 import QtCore
|
||||
|
||||
|
||||
logger = logging.getLogger("logger")
|
||||
|
||||
|
||||
class Database(sqlite3.Connection):
|
||||
def __init__(self, database: str, *args, **kwargs):
|
||||
self.dir = QtCore.QStandardPaths.standardLocations(
|
||||
QtCore.QStandardPaths.StandardLocation.CacheLocation
|
||||
)[0]
|
||||
os.makedirs(self.dir, exist_ok=True)
|
||||
path = os.path.join(self.dir, database + ".db.sqlite3")
|
||||
super(Database, self).__init__(database=path, *args, **kwargs)
|
||||
self.row_factory = sqlite3.Row
|
||||
Reference in New Issue
Block a user