diff options
| author | 2021-09-30 11:16:23 +0200 | |
|---|---|---|
| committer | 2021-09-30 11:16:23 +0200 | |
| commit | 231075f28df55bfb622f54859f858528445cae0c (patch) | |
| tree | ffdc27f31646d10e35902087fa6c703bc49bfc82 /internal/db/bundb | |
| parent | handle remote account deletion more systematically (#254) (diff) | |
| download | gotosocial-231075f28df55bfb622f54859f858528445cae0c.tar.xz | |
Golint (#255)
Diffstat (limited to 'internal/db/bundb')
| -rw-r--r-- | internal/db/bundb/bundb.go | 2 | ||||
| -rw-r--r-- | internal/db/bundb/conn.go | 3 | 
2 files changed, 4 insertions, 1 deletions
| diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go index e1879f247..e6ebe5d88 100644 --- a/internal/db/bundb/bundb.go +++ b/internal/db/bundb/bundb.go @@ -45,6 +45,8 @@ import (  	"github.com/uptrace/bun/dialect/pgdialect"  	"github.com/uptrace/bun/dialect/sqlitedialect"  	"github.com/uptrace/bun/migrate" + +	// blank import for the sqlite driver for bun  	_ "modernc.org/sqlite"  ) diff --git a/internal/db/bundb/conn.go b/internal/db/bundb/conn.go index abaebcebd..aeb1b5db0 100644 --- a/internal/db/bundb/conn.go +++ b/internal/db/bundb/conn.go @@ -10,7 +10,7 @@ import (  	"github.com/uptrace/bun/dialect"  ) -// dbConn wrapps a bun.DB conn to provide SQL-type specific additional functionality +// DBConn wrapps a bun.DB conn to provide SQL-type specific additional functionality  type DBConn struct {  	// TODO: move *Config here, no need to be in each struct type @@ -37,6 +37,7 @@ func WrapDBConn(dbConn *bun.DB, log *logrus.Logger) *DBConn {  	}  } +// RunInTx wraps execution of the supplied transaction function.  func (conn *DBConn) RunInTx(ctx context.Context, fn func(bun.Tx) error) db.Error {  	// Acquire a new transaction  	tx, err := conn.BeginTx(ctx, nil) | 
