package db import "gorm.io/gorm" type DeleteBuilder[T any] struct { Expr db *gorm.DB } func NewDeleteBuilder[T any](db *gorm.DB) *DeleteBuilder[T] { return &DeleteBuilder[T]{Expr{}, db} } func (b *DeleteBuilder[T]) Commit() (int64, error) { var t T res := b.db.Scopes(b.Scopes).Delete(&t) return res.RowsAffected, res.Error }