View definition

(*Callback).Create

Defined in github.com/jinzhu/gorm/callback.go

Description

Create could be used to register callbacks for creating object

db.Callback().Create().After("gorm:create").Register("plugin:run_after_create", func(*Scope) {
  // business logic
  ...

  // set error if some thing wrong happened, will rollback the creating
  scope.Err(errors.New("error"))
})

Create is referenced in 10 repositories

github.com/jinzhu/gorm github.com/qor/publish github.com/qor/microsite

...