Skip to content

Commit

Permalink
🗑️del override func and explicit dialector has SavePointerDialectorIn…
Browse files Browse the repository at this point in the history
…terface
  • Loading branch information
iChemy committed Feb 17, 2024
1 parent f60801a commit 39a9cfe
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions infra/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (repo *GormRepository) Setup(host, user, password, database, port, key, log
// dialector with custom error handling
type dialector struct {
gorm.Dialector
gorm.SavePointerDialectorInterface
}

var (
Expand All @@ -86,22 +87,3 @@ func (d dialector) Translate(err error) error {

return defaultErrorHandling(err)
}

func (d dialector) SavePoint(tx *gorm.DB, name string) error {
var err error = nil
if savePointer, ok := d.Dialector.(gorm.SavePointerDialectorInterface); ok {
err = savePointer.SavePoint(tx, name)
} else {
err = gorm.ErrUnsupportedDriver
}
return defaultErrorHandling(err)
}
func (d dialector) RollbackTo(tx *gorm.DB, name string) error {
var err error = nil
if savePointer, ok := d.Dialector.(gorm.SavePointerDialectorInterface); ok {
err = savePointer.RollbackTo(tx, name)
} else {
err = gorm.ErrUnsupportedDriver
}
return defaultErrorHandling(err)
}

0 comments on commit 39a9cfe

Please sign in to comment.