You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
426 B
29 lines
426 B
package repository |
|
|
|
import ( |
|
"gorm.io/gorm" |
|
) |
|
|
|
type BaseRepo struct { |
|
db *gorm.DB |
|
} |
|
|
|
func NewBaseRepo(db *gorm.DB) *BaseRepo { |
|
return &BaseRepo{db: db} |
|
} |
|
|
|
func (r *BaseRepo) DB() *gorm.DB { |
|
return r.db |
|
} |
|
|
|
func (r *BaseRepo) Begin() *gorm.DB { |
|
return r.db.Begin() |
|
} |
|
|
|
func (r *BaseRepo) Commit(tx *gorm.DB) error { |
|
return tx.Commit().Error |
|
} |
|
|
|
func (r *BaseRepo) Rollback(tx *gorm.DB) error { |
|
return tx.Rollback().Error |
|
}
|
|
|