Golang SQLite:如何在意外关闭时防止文件损坏?

Golang SQLite: How to prevent file corruption upon unexpected shutdowns?

我在嵌入式设备上运行的应用程序上使用 github.com/jinzhu/gorm 和 sqlite。此设备可能随时关闭。

有没有办法在每次 SQL 调用后告诉 sqlite close/flush 一切?

SQlite uses transactions,并在事务提交时刷新所有内容。

因此默认情况下 SQLite 是安全的(除非您的设备 is broken)。