scryer-db 0.3.0

Database models and Turso/SQLite storage layer for Scryer code intelligence
use toasty::Model;

/// A reference or call edge whose target named no stored symbol when it was indexed (standard
/// library and other external code, or a symbol that does not exist yet). Kept so that a later
/// run or edit that adds a symbol of that name can link it without re-indexing the file.
#[derive(Debug, Clone, Model)]
#[table = "unresolved_reference"]
pub struct UnresolvedReference {
    #[key]
    #[auto]
    pub id: u64,
    pub project_id: u64,
    /// The file the reference occurs in.
    #[index]
    pub file_id: u64,
    /// The target as written: a bare name or a qualified path.
    pub target_name: String,
    /// The last segment of `target_name`, which is what candidate symbols are looked up by.
    #[index]
    pub bare_name: String,
    /// "reference" or "edge".
    pub kind: String,
    pub role: String,
    pub start_byte: usize,
    pub end_byte: usize,
    pub line_number: u32,
    /// How the target was chosen once linked: "exact", "name" or "macro".
    pub via: String,
    /// For an edge, the calling symbol; 0 for a reference.
    pub source_symbol_id: u64,
    /// For an edge, its type ("calls", "implements", ...); empty for a reference.
    pub edge_type: String,
}