Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckpointAndClose ¶ added in v1.51.0
CheckpointAndClose runs a final WAL checkpoint and closes the database. The TRUNCATE checkpoint folds the -wal file back into the main database so it isn't left behind on disk after shutdown. A checkpoint failure is logged but does not prevent the close.
func CloseDB ¶ added in v1.137.0
CloseDB closes db and waits until every connection has actually been released. sql.DB.Close only closes idle connections: one checked out by an in-flight statement is closed when that statement returns, after Close has already come back. On Windows the database file cannot be deleted while such a connection still holds it, so callers that remove the directory right after closing (tests with t.TempDir, recovery paths) need the handle gone before Close returns. Waiting is bounded so a wedged statement cannot hang shutdown.
func DiagnoseDBOpenError ¶
DiagnoseDBOpenError provides a more helpful error message when SQLite fails to open/create a database file.
func IsCantOpenError ¶
IsCantOpenError checks if the error is a SQLite CANTOPEN error (code 14).
func IsTransientError ¶ added in v1.102.0
IsTransientError reports whether err is a temporary condition that a retry (not a schema fix) would resolve: a canceled/expired context, or a SQLite BUSY/LOCKED error from a concurrent writer. The primary result code is compared after masking off extended-code bits (e.g. SQLITE_BUSY_SNAPSHOT).
Types ¶
This section is empty.