Move to own sql abstraction on top of jmoiron/sqlx

This commit is contained in:
2022-12-07 22:11:44 +01:00
parent d27e3d9a91
commit 8db0fa37db
34 changed files with 584 additions and 265 deletions

View File

@@ -2,8 +2,8 @@ package logic
import (
"blackforestbytes.com/simplecloudnotifier/db"
"blackforestbytes.com/simplecloudnotifier/sq"
"context"
"database/sql"
"errors"
"github.com/rs/zerolog/log"
"time"
@@ -13,7 +13,7 @@ type SimpleContext struct {
inner context.Context
cancelFunc context.CancelFunc
cancelled bool
transaction *sql.Tx
transaction sq.Tx
}
func CreateSimpleContext(innerCtx context.Context, cancelFn context.CancelFunc) *SimpleContext {
@@ -54,7 +54,7 @@ func (sc *SimpleContext) Cancel() {
sc.cancelFunc()
}
func (sc *SimpleContext) GetOrCreateTransaction(db *db.Database) (*sql.Tx, error) {
func (sc *SimpleContext) GetOrCreateTransaction(db *db.Database) (sq.Tx, error) {
if sc.cancelled {
return nil, errors.New("context cancelled")
}