Auto-delete clients when FB returns UNREGISTERED
All checks were successful
Build Docker and Deploy / Build Docker Container (push) Successful in 1m53s
Build Docker and Deploy / Deploy to Server (push) Successful in 7s

This commit is contained in:
2024-09-16 20:11:28 +02:00
parent 7ddaf5d9aa
commit e329e13a02
19 changed files with 827 additions and 324 deletions

View File

@@ -95,3 +95,20 @@ func (sc *SimpleContext) RollbackTransaction() {
sc.transaction = nil
return
}
func Run[TResp any](outctx context.Context, f func(ctx db.TxContext) (TResp, error)) (TResp, error) {
sctx := CreateSimpleContext(outctx, nil)
defer sctx.Cancel()
res, err := f(sctx)
if err != nil {
return *new(TResp), err
}
err = sctx.CommitTransaction()
if err != nil {
return *new(TResp), err
}
return res, nil
}