model.go 772 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package rest
  2. import (
  3. "git.nspix.com/golang/micro/gateway/http"
  4. "gorm.io/gorm"
  5. )
  6. type (
  7. Model interface {
  8. ModuleName() string
  9. TableName() string
  10. Scenario() []string
  11. }
  12. Migrating interface {
  13. Defaults() []MigrateValue
  14. }
  15. MigrateValue struct {
  16. Value interface{}
  17. Conditions interface{}
  18. }
  19. KvMapping interface {
  20. LabelField() string
  21. ValueField() string
  22. }
  23. mappingValue struct {
  24. Label string `json:"label"`
  25. Value string `json:"value"`
  26. }
  27. // FilterColumnInterface 过滤回调函数
  28. FilterColumnInterface interface {
  29. OnSearchColumn(ctx *http.Context, query *Query, schema *Schema) (err error)
  30. }
  31. // RequestHandleFunc 处理HTTP请求回调函数
  32. RequestHandleFunc func(ctx *http.Context, tx *gorm.DB, model interface{}) (err error)
  33. )