processors.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2015 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xorm
  5. // BeforeInsertProcessor executed before an object is initially persisted to the database
  6. type BeforeInsertProcessor interface {
  7. BeforeInsert()
  8. }
  9. // BeforeUpdateProcessor executed before an object is updated
  10. type BeforeUpdateProcessor interface {
  11. BeforeUpdate()
  12. }
  13. // BeforeDeleteProcessor executed before an object is deleted
  14. type BeforeDeleteProcessor interface {
  15. BeforeDelete()
  16. }
  17. // BeforeSetProcessor executed before data set to the struct fields
  18. type BeforeSetProcessor interface {
  19. BeforeSet(string, Cell)
  20. }
  21. // AfterSetProcessor executed after data set to the struct fields
  22. type AfterSetProcessor interface {
  23. AfterSet(string, Cell)
  24. }
  25. // !nashtsai! TODO enable BeforeValidateProcessor when xorm start to support validations
  26. //// Executed before an object is validated
  27. //type BeforeValidateProcessor interface {
  28. // BeforeValidate()
  29. //}
  30. // --
  31. // AfterInsertProcessor executed after an object is persisted to the database
  32. type AfterInsertProcessor interface {
  33. AfterInsert()
  34. }
  35. // AfterUpdateProcessor executed after an object has been updated
  36. type AfterUpdateProcessor interface {
  37. AfterUpdate()
  38. }
  39. // AfterDeleteProcessor executed after an object has been deleted
  40. type AfterDeleteProcessor interface {
  41. AfterDelete()
  42. }