mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 17:00:02 +02:00
Remove NewSession method from db.Engine interface (#17577)
* Remove NewSession method from db.Engine interface * Fix bug * Some improvements * Fix bug * Fix test * Use XXXBean instead of XXXExample
This commit is contained in:
parent
0add627182
commit
d710af6669
44 changed files with 600 additions and 620 deletions
|
@ -1098,17 +1098,17 @@ func UpdateComment(c *Comment, doer *User) error {
|
|||
|
||||
// DeleteComment deletes the comment
|
||||
func DeleteComment(comment *Comment) error {
|
||||
sess := db.NewSession(db.DefaultContext)
|
||||
defer sess.Close()
|
||||
if err := sess.Begin(); err != nil {
|
||||
ctx, committer, err := db.TxContext()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer committer.Close()
|
||||
|
||||
if err := deleteComment(db.GetEngine(ctx), comment); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := deleteComment(sess, comment); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return sess.Commit()
|
||||
return committer.Commit()
|
||||
}
|
||||
|
||||
func deleteComment(e db.Engine, comment *Comment) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue