Skip to main content

upsert_entity

Function upsert_entity 

Source
pub fn upsert_entity(
    conn: &Connection,
    namespace: &str,
    e: &NewEntity,
) -> Result<i64, AppError>
Expand description

Upserts an entity and returns its primary key.

Uses ON CONFLICT(namespace, name) to keep one row per entity within a namespace, refreshing type and description opportunistically.

ยงErrors

Returns Err(AppError::Database) on any rusqlite failure.