type Approval.agent as Ident
This commit is contained in:
parent
8c1979f05c
commit
76647415af
10 changed files with 71 additions and 53 deletions
|
|
@ -307,7 +307,7 @@ impl Approvals {
|
|||
/// across both callers (one suppressed the lint, the other aliased the
|
||||
/// tuple) — one named projection + mapper now backs both.
|
||||
struct ApprovalLookup {
|
||||
agent: String,
|
||||
agent: hive_types::Ident,
|
||||
kind: String,
|
||||
commit_ref: String,
|
||||
requested_at: i64,
|
||||
|
|
@ -323,8 +323,16 @@ impl ApprovalLookup {
|
|||
description FROM approvals WHERE id = ?1";
|
||||
|
||||
fn from_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<Self> {
|
||||
let agent: String = row.get(0)?;
|
||||
let agent = hive_types::Ident::parse(&agent).map_err(|e| {
|
||||
rusqlite::Error::FromSqlConversionFailure(
|
||||
0,
|
||||
rusqlite::types::Type::Text,
|
||||
format!("invalid approval agent {agent:?}: {e}").into(),
|
||||
)
|
||||
})?;
|
||||
Ok(Self {
|
||||
agent: row.get(0)?,
|
||||
agent,
|
||||
kind: row.get(1)?,
|
||||
commit_ref: row.get(2)?,
|
||||
requested_at: row.get(3)?,
|
||||
|
|
@ -399,9 +407,17 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
|
|||
));
|
||||
}
|
||||
};
|
||||
let agent: String = row.get(1)?;
|
||||
let agent = hive_types::Ident::parse(&agent).map_err(|e| {
|
||||
rusqlite::Error::FromSqlConversionFailure(
|
||||
1,
|
||||
rusqlite::types::Type::Text,
|
||||
format!("invalid approval agent {agent:?}: {e}").into(),
|
||||
)
|
||||
})?;
|
||||
Ok(Approval {
|
||||
id: row.get(0)?,
|
||||
agent: row.get(1)?,
|
||||
agent,
|
||||
kind,
|
||||
commit_ref: row.get(3)?,
|
||||
requested_at: hive_sh4re::wire_time::from_secs(row.get(4)?),
|
||||
|
|
|
|||
Loading…
Reference in a new issue