+
+ fn upsert(
+ conn: &PgConnection,
+ private_message_form: &PrivateMessageForm,
+ ) -> Result<PrivateMessage, Error> {
+ use lemmy_db_schema::schema::private_message::dsl::*;
+ insert_into(private_message)
+ .values(private_message_form)
+ .on_conflict(ap_id)
+ .do_update()
+ .set(private_message_form)
+ .get_result::<Self>(conn)
+ }