upsert_node

Function upsert_node 

Source
pub(crate) async fn upsert_node(
    pool: &PgPool,
    reflector: &str,
    node_callsign: &str,
    module: Option<&str>,
    now: DateTime<Utc>,
) -> Result<(), Error>
Expand description

Upserts a single connected node entry.

Inserts a new node or updates the existing entry’s module, last_heard, and connected_since if the node is already tracked for this reflector. The composite primary key (reflector, node_callsign) prevents duplicates.

§Errors

Returns sqlx::Error on connection or foreign-key constraint failures (the referenced reflector must exist in the reflectors table).