程序退出时关闭sqlite数据库

This commit is contained in:
刘祥超
2022-09-26 16:14:24 +08:00
parent 54b66805f9
commit 1d46c446cf

View File

@@ -20,6 +20,9 @@ func NewDB(rawDB *sql.DB) *DB {
rawDB: rawDB,
}
events.OnKey(events.EventQuit, fmt.Sprintf("db_%p", db), func() {
_ = rawDB.Close()
})
events.OnKey(events.EventTerminated, fmt.Sprintf("db_%p", db), func() {
_ = rawDB.Close()
})