我正在try 使用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()
或on_conflict_do_replace()
这样的东西.