RUST SDK How to insert an array of data with ON DUPLICATE? #5689
-
I see that using the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Because let _: Vec<Thing> = db.insert("website").content(all).await.unwrap(); works, except that I need custom logic on it. match db.query("INSERT INTO website (site, cralwed) VALUES $array
ON DUPLICATE KEY UPDATE
accessed_at = time::now(),
crawled = crawled OR $input.crawled;
")
.bind(("array", all))
.await
{ ... } This doesn't work, as it crashes with the above error |
Beta Was this translation helpful? Give feedback.
-
Alright, here's working code: db.query("INSERT INTO website $array
ON DUPLICATE KEY UPDATE
accessed_at = time::now(),
crawled = crawled OR $input.crawled
RETURN VALUE id;
")
.bind(("array", all)).await; |
Beta Was this translation helpful? Give feedback.
Alright, here's working code: