dev: 初步支持查询过滤

This commit is contained in:
Julian Freeman
2024-07-19 11:07:30 -04:00
parent aca88dd952
commit aa4d88b980
6 changed files with 164 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ columns_d = {
"notes": Column("notes", DataType.BLOB),
"path": Column("path", DataType.BLOB, nullable=False),
}
all_columns = [
columns_d["entry_id"],
columns_d["title"],
@@ -21,3 +22,10 @@ all_columns = [
columns_d["notes"],
columns_d["path"],
]
query_columns = [
columns_d["entry_id"],
columns_d["title"],
columns_d["username"],
columns_d["url"],
]

4
lib/global_config.py Normal file
View File

@@ -0,0 +1,4 @@
# coding: utf8
table_name = "entries"
button_min_width = 120

View File

@@ -2,6 +2,7 @@
from os import PathLike
from pykeepass import PyKeePass
from .Sqlite3Helper import Sqlite3Worker, BlobType, Column
from .global_config import table_name
def trim_str(value):
@@ -40,8 +41,8 @@ def read_kps_to_db(kps_file: str | PathLike[str], password: str,
extract_otp(entry.otp),
blob_fy(trim_str(entry.url)),
blob_fy(entry.notes),
blob_fy("::".join(entry.path[:-1])),
blob_fy("::".join([kps_file] + entry.path[:-1])),
])
sqh.insert_into("entries", columns, values)
sqh.insert_into(table_name, columns, values)
return kp