mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Restructure data layer (#2532)
* Add new txn manager interface * Add txn management to sqlite * Rename get to getByID * Add contexts to repository methods * Update query builders * Add context to reader writer interfaces * Use repository in resolver * Tighten interfaces * Tighten interfaces in dlna * Tighten interfaces in match package * Tighten interfaces in scraper package * Tighten interfaces in scan code * Tighten interfaces on autotag package * Remove ReaderWriter usage * Merge database package into sqlite
This commit is contained in:
@@ -14,7 +14,7 @@ type GeneratePhashTask struct {
|
||||
Scene models.Scene
|
||||
Overwrite bool
|
||||
fileNamingAlgorithm models.HashAlgorithm
|
||||
txnManager models.TransactionManager
|
||||
txnManager models.Repository
|
||||
}
|
||||
|
||||
func (t *GeneratePhashTask) GetDescription() string {
|
||||
@@ -40,14 +40,14 @@ func (t *GeneratePhashTask) Start(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.txnManager.WithTxn(ctx, func(r models.Repository) error {
|
||||
qb := r.Scene()
|
||||
if err := t.txnManager.WithTxn(ctx, func(ctx context.Context) error {
|
||||
qb := t.txnManager.Scene
|
||||
hashValue := sql.NullInt64{Int64: int64(*hash), Valid: true}
|
||||
scenePartial := models.ScenePartial{
|
||||
ID: t.Scene.ID,
|
||||
Phash: &hashValue,
|
||||
}
|
||||
_, err := qb.Update(scenePartial)
|
||||
_, err := qb.Update(ctx, scenePartial)
|
||||
return err
|
||||
}); err != nil {
|
||||
logger.Error(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user