我在postgresql中使用了vapor ,我想一次保存大量数据,但我不知道如何使用postgresql事务,谁能举个例子。
如果您使用的是Fluent(支持 PostgresQL 的 Vapor 数据库 ORM),那么您只需使用:
drop.database?.transaction { conn in
try modelToSave.makeQuery(conn).save()
try nextModelToSave.makeQuery(conn).save()
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句