Add more meta information to trove entries
This commit is contained in:
parent
4ada169bbe
commit
bd4d571c95
5 changed files with 80 additions and 7 deletions
|
|
@ -71,7 +71,7 @@ class Sqlite3Trove:
|
|||
con.commit()
|
||||
obj = cls(con)
|
||||
if initialize:
|
||||
obj.write_blob(b"", NODE_ROOT_ID)
|
||||
obj.write_blob(b"", NOTE_ROOT_ID)
|
||||
return obj
|
||||
|
||||
def close(self):
|
||||
|
|
@ -103,6 +103,15 @@ class Sqlite3Trove:
|
|||
return None
|
||||
return bytes(row["data"]) if row["data"] is not None else b""
|
||||
|
||||
def get_mtime(self, object_id: int) -> datetime | None:
|
||||
"""Return the modified timestamp for an object, or None if not found."""
|
||||
row = self._con.execute(
|
||||
"SELECT modified FROM objects WHERE id = ?", (object_id,)
|
||||
).fetchone()
|
||||
if row is None:
|
||||
return None
|
||||
return datetime.fromisoformat(row["modified"])
|
||||
|
||||
def read_metadata(self, object_id: int, key: str) -> bytes | None:
|
||||
"""Return raw metadata value for (uuid, key), or None if not found."""
|
||||
row = self._con.execute(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue