insertEdge writes a graph edge with a per-persist monotonic id, so the primary key can never collide within a run's diff materialization.
(tx *sql.Tx, runID, from, to, edgeType, now string, seq *int)
| 413 | // insertEdge writes a graph edge with a per-persist monotonic id, so the primary |
| 414 | // key can never collide within a run's diff materialization. |
| 415 | func insertEdge(tx *sql.Tx, runID, from, to, edgeType, now string, seq *int) error { |
| 416 | *seq++ |
| 417 | _, err := tx.Exec(`INSERT INTO graph_edges (id, run_id, from_id, to_id, edge_type, created_at) |
| 418 | VALUES (?, ?, ?, ?, ?, ?)`, |
| 419 | fmt.Sprintf("edge-%s-%s-%d", edgeType, runID, *seq), runID, from, to, edgeType, now) |
| 420 | return err |
| 421 | } |
| 422 | |
| 423 | // --- small string helpers shared across the package --- |
| 424 |