Skip to content

Commit

Permalink
Removed unneccesary function pointer declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
markdicksonjr committed Jul 4, 2019
1 parent ce32aff commit 7ed009b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions user/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ type Extension struct {

PersistenceExtension PersistenceExtension

OnBeforeUserCreate *func(user *User)
OnAfterUserCreate *func(user *User)
OnBeforeUserUpdate *func(user *User)
OnAfterUserUpdate *func(user *User)
OnBeforePasswordUpdate *func(user *User)
OnAfterPasswordUpdate *func(user *User)
OnBeforeUserCreate func(user *User)
OnAfterUserCreate func(user *User)
OnBeforeUserUpdate func(user *User)
OnAfterUserUpdate func(user *User)
OnBeforePasswordUpdate func(user *User)
OnAfterPasswordUpdate func(user *User)
}

func (s *Extension) Init(app *nibbler.Application) error {
Expand Down Expand Up @@ -90,7 +90,7 @@ func (s *Extension) Create(user *User) (*User, error) {

// call the OnBeforeUserCreate callback if provided
if s.OnBeforeUserCreate != nil {
(*s.OnBeforeUserCreate)(user)
s.OnBeforeUserCreate(user)
}

// save the new user to the DB
Expand All @@ -103,7 +103,7 @@ func (s *Extension) Create(user *User) (*User, error) {

// call the OnAfterUserCreate callback if provided
if s.OnAfterUserCreate != nil {
(*s.OnAfterUserCreate)(resultUser)
s.OnAfterUserCreate(resultUser)
}

return resultUser, err
Expand All @@ -116,7 +116,7 @@ func (s *Extension) Update(user *User) error {

// call the OnBeforeUserUpdate callback if provided
if s.OnBeforeUserUpdate != nil {
(*s.OnBeforeUserUpdate)(user)
s.OnBeforeUserUpdate(user)
}

// change user user in the DB
Expand All @@ -126,7 +126,7 @@ func (s *Extension) Update(user *User) error {

// call the OnAfterUserUpdate callback if provided
if s.OnAfterUserUpdate != nil {
(*s.OnAfterUserUpdate)(user)
s.OnAfterUserUpdate(user)
}

return nil
Expand All @@ -139,7 +139,7 @@ func (s *Extension) UpdatePassword(user *User) error {

// call the OnBeforePasswordUpdate callback if provided
if s.OnBeforePasswordUpdate != nil {
(*s.OnBeforePasswordUpdate)(user)
s.OnBeforePasswordUpdate(user)
}

// change user user in the DB
Expand All @@ -149,7 +149,7 @@ func (s *Extension) UpdatePassword(user *User) error {

// call the OnAfterUserUpdate callback if provided
if s.OnAfterPasswordUpdate != nil {
(*s.OnAfterPasswordUpdate)(user)
s.OnAfterPasswordUpdate(user)
}

return nil
Expand Down

0 comments on commit 7ed009b

Please sign in to comment.