Debug output

December 8, 2021 ยท View on GitHub

Go
Reference

dbw provides a few ways to get debug output from the underlying database.

DB.Debug(...)

// enable debug output for all database operations
db, err := dbw.Open(dbw.Sqlite, "dbw.db") 
db.Debug(true)

WithDebug(...)

Operations may take the WithDebug(...) option which will enable/disable debug output for the duration of that operation.

// enable debug output for a create operation
rw.Create(ctx, &user, dbw.WithDebug(true))