use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::models;
#[derive(Debug, sqlx::FromRow, Eq, PartialEq, Serialize, Deserialize)]
pub struct ResolvedSymbol {
pub id: i64,
pub name: String,
pub kind: models::parsed::SymbolKind,
#[sqlx[try_from = "String"]]
pub path: PathBuf,
#[sqlx(default)]
#[sqlx[try_from = "i64"]]
pub score: models::resolved::Score,
pub start_line: i64,
pub end_line: i64,
pub start_column: i64,
pub end_column: i64,
}
impl PartialOrd for ResolvedSymbol {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for ResolvedSymbol {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
match self.path.cmp(&other.path) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
match self.name.cmp(&other.name) {
core::cmp::Ordering::Equal => {}
ord => return ord,
}
self.start_line.cmp(&other.start_line)
}
}