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