entity.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package rule
  2. import (
  3. "git.sxidc.com/go-framework/baize/framework/core/domain"
  4. "git.sxidc.com/go-framework/baize/framework/core/domain/entity"
  5. )
  6. const (
  7. FieldScope = "Scope"
  8. FieldDomainName = "DomainName"
  9. FieldRule = "Rule"
  10. FieldEnabled = "Enabled"
  11. )
  12. var (
  13. ColumnScope = domain.ColumnName(FieldScope)
  14. ColumnDomainName = domain.ColumnName(FieldDomainName)
  15. ColumnRule = domain.ColumnName(FieldRule)
  16. ColumnEnabled = domain.ColumnName(FieldEnabled)
  17. )
  18. var fieldMap = map[string]string{
  19. FieldScope: "范围",
  20. FieldDomainName: "领域名",
  21. FieldRule: "规则",
  22. }
  23. type Entity struct {
  24. entity.Base
  25. Scope string `sqlmapping:"column:scope;notUpdate;" sqlresult:"column:scope;" check:"required,lte=256,when=create"`
  26. DomainName string `sqlmapping:"column:domain_name;notUpdate;" sqlresult:"column:domain_name;" check:"required,lte=256,when=create"`
  27. Rule string `sqlmapping:"column:rule;notUpdate;" sqlresult:"column:rule;" check:"required,when=create"`
  28. Enabled bool `sqlresult:"column:enabled;" sqlresult:"column:enabled;"`
  29. }
  30. func (e *Entity) DomainCNName() string {
  31. return "查询规则"
  32. }
  33. func (e *Entity) DomainCamelName() string {
  34. return "QueryRule"
  35. }
  36. func (e *Entity) GetFieldMap() map[string]string {
  37. return fieldMap
  38. }