value_object.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package sql_executor
  2. import (
  3. "git.sxidc.com/go-framework/baize/framework/core/domain"
  4. "git.sxidc.com/go-framework/baize/framework/core/domain/value_object"
  5. "time"
  6. )
  7. const (
  8. FieldSql = "Sql"
  9. FieldExecutorID = "ExecutorID"
  10. FieldExecutorName = "ExecutorName"
  11. FieldExecutedTime = "ExecutedTime"
  12. )
  13. var (
  14. ColumnSql = domain.ColumnName(FieldSql)
  15. ColumnExecutorID = domain.ColumnName(FieldExecutorID)
  16. ColumnExecutorName = domain.ColumnName(FieldExecutorName)
  17. ColumnExecutedTime = domain.ColumnName(FieldExecutedTime)
  18. )
  19. var fieldMap = map[string]string{
  20. FieldSql: "SQL语句",
  21. FieldExecutorID: "执行者ID",
  22. FieldExecutorName: "执行者姓名",
  23. FieldExecutedTime: "执行时间",
  24. }
  25. type SqlExecuteLog struct {
  26. value_object.Base
  27. Sql string `sqlmapping:"column:sql;" sqlresult:"column:sql;" check:"required,when=create"`
  28. ExecutorID string `sqlmapping:"column:executor_id;" sqlresult:"column:executor_id;" check:"required,len=32,when=create"`
  29. ExecutorName string `sqlmapping:"column:executor_name;" sqlresult:"column:executor_name;" check:"required,lte=256,when=create"`
  30. ExecutedTime time.Time `sqlmapping:"column:executed_time;" sqlresult:"column:executed_time;"`
  31. }
  32. func (sqlExecuteLog *SqlExecuteLog) DomainCNName() string {
  33. return "SQL日志"
  34. }
  35. func (sqlExecuteLog *SqlExecuteLog) DomainCamelName() string {
  36. return "SqlExecuteLog"
  37. }
  38. func (sqlExecuteLog *SqlExecuteLog) GetFieldMap() map[string]string {
  39. return fieldMap
  40. }