Skip to content

Commit

Permalink
style(psqlutil): fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bradub committed Jan 10, 2025
1 parent 80fc835 commit dce7673
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions psqlutil/gorm_plugin.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package psqlutil

import (
"gorm.io/gorm"
"github.com/lib/pq"
"database/sql"

"github.com/lib/pq"
"github.com/purposeinplay/go-commons/errors"
"gorm.io/gorm"
)

var _ gorm.ErrorTranslator

// GORMErrorsPlugin is a plugin for GORM that handles postgres specific errors.
type GORMErrorsPlugin struct{}

func (p GORMErrorsPlugin) Name() string {
// Name returns the name of the plugin.
func (GORMErrorsPlugin) Name() string {
return "psqlerrors"
}

// Initialize registers the plugin with the GORM db.
func (p GORMErrorsPlugin) Initialize(db *gorm.DB) (err error) {
cb := db.Callback()

Expand All @@ -26,7 +32,7 @@ func (p GORMErrorsPlugin) Initialize(db *gorm.DB) (err error) {
)
}

func (p GORMErrorsPlugin) handleError(tx *gorm.DB) {
func (GORMErrorsPlugin) handleError(tx *gorm.DB) {
err := tx.Error

if err == nil {
Expand Down

0 comments on commit dce7673

Please sign in to comment.