Persistência (SQLite)¶
Database layer for semtree.
schema ¶
SQLite schema v1 for semtree.
Design goals: - FTS5 full-text search on symbol names and docstrings - Vec-ready: embedding column stored as BLOB (sqlite-vec compatible) - Incremental hashing: skip re-parse if SHA-1 unchanged - Lean writes: single transaction per file update
store ¶
All CRUD operations against the semtree SQLite database.
Typed returns throughout - no bare Any in public API.
get_file_sha1 ¶
Return the stored SHA-1 for rel_path, or None if not indexed.
upsert_file ¶
Insert or update a file record. Returns the file id.
delete_file ¶
Remove a file and all its symbols (CASCADE handles symbols).
replace_file_symbols ¶
Delete existing symbols for file_id and insert fresh batch.
Each dict in symbols must have: name, kind, line_start, line_end, signature, docstring. git_author and git_date are optional.
fts_search ¶
Full-text search across symbol names, signatures, and docstrings.
get_symbols_for_file ¶
Return all symbols for a given relative file path.
get_symbols_by_name ¶
Exact-match symbol name lookup, optionally filtered by kind.
delete_memory ¶
Delete a memory entry. Returns True if a row was deleted.