minus-squareacqrs@acqrs.co.uktoRust Programming@lemmy.ml•Lemmy Server's (lemmy_server) Rust code, Diesel ORM - how can I have conditional logic if it was an SQL UPDATE instead of a SQL INSERTlinkfedilinkarrow-up2·edit-21 year agoBefore the upsert, do a select where the result is optional. Then if_some() it was an update, if_none() it was an insert. Looks like the on_conflict is on the ap_url, so I would use that as the key you’re trying to pull in the select. linkfedilink
Before the upsert, do a select where the result is optional. Then if_some() it was an update, if_none() it was an insert.
Looks like the on_conflict is on the ap_url, so I would use that as the key you’re trying to pull in the select.