我正在尝试使用Diesel和 PostgreSQL 执行插入或更新。
我努力了:
diesel::insert_into($table::table).values(&objects).on_conflict($table::id).do_update().set(&objects).execute(conn).unwrap();
哪里objects
是std::vec::Vec<Struct>
- 导致编译器错误:
^^^ the trait 'diesel::query_builder::AsChangeset' is not implemented for '&std::vec::Vec<Struct>'
查询生成器中有一个on_conflict_do_nothing()
,但我似乎找不到类似on_conflict_do_update()
or的东西on_conflict_do_replace()
。