You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

taskhpcmodel_gen.go 4.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Code generated by goctl. DO NOT EDIT.
  2. package models
  3. import (
  4. "context"
  5. "database/sql"
  6. "fmt"
  7. "strings"
  8. "time"
  9. "github.com/zeromicro/go-zero/core/stores/builder"
  10. "github.com/zeromicro/go-zero/core/stores/sqlc"
  11. "github.com/zeromicro/go-zero/core/stores/sqlx"
  12. "github.com/zeromicro/go-zero/core/stringx"
  13. )
  14. var (
  15. taskHpcFieldNames = builder.RawFieldNames(&TaskHpc{})
  16. taskHpcRows = strings.Join(taskHpcFieldNames, ",")
  17. taskHpcRowsExpectAutoSet = strings.Join(stringx.Remove(taskHpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
  18. taskHpcRowsWithPlaceHolder = strings.Join(stringx.Remove(taskHpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
  19. )
  20. type (
  21. taskHpcModel interface {
  22. Insert(ctx context.Context, data *TaskHpc) (sql.Result, error)
  23. FindOne(ctx context.Context, id int64) (*TaskHpc, error)
  24. Update(ctx context.Context, data *TaskHpc) error
  25. Delete(ctx context.Context, id int64) error
  26. }
  27. defaultTaskHpcModel struct {
  28. conn sqlx.SqlConn
  29. table string
  30. }
  31. TaskHpc struct {
  32. Id int64 `db:"id"` // id
  33. TaskId int64 `db:"task_id"` // 任务id
  34. JobId string `db:"job_id"` // 作业id(在第三方系统中的作业id)
  35. AdapterId int64 `db:"adapter_d"` // 适配器id
  36. AdapterName string `db:"adapter_name"` //适配器名称
  37. ClusterId int64 `db:"cluster_id"` //集群id
  38. ClusterName string `db:"cluster_name"` //集群名称
  39. Name string `db:"name"` // 名称
  40. Status string `db:"status"` // 状态
  41. CmdScript string `db:"cmd_script"`
  42. StartTime string `db:"start_time"` // 开始时间
  43. RunningTime int64 `db:"running_time"` // 运行时间
  44. DerivedEs string `db:"derived_es"`
  45. Cluster string `db:"cluster"`
  46. BlockId int64 `db:"block_id"`
  47. AllocNodes int64 `db:"alloc_nodes"`
  48. AllocCpu int64 `db:"alloc_cpu"`
  49. CardCount int64 `db:"card_count"` // 卡数
  50. Version string `db:"version"`
  51. Account string `db:"account"`
  52. WorkDir string `db:"work_dir"` // 工作路径
  53. AssocId int64 `db:"assoc_id"`
  54. ExitCode int64 `db:"exit_code"`
  55. WallTime string `db:"wall_time"` // 最大运行时间
  56. Result string `db:"result"` // 运行结果
  57. DeletedAt sql.NullTime `db:"deleted_at"` // 删除时间
  58. YamlString string `db:"yaml_string"`
  59. AppType string `db:"app_type"` // 应用类型
  60. AppName string `db:"app_name"` // 应用名称
  61. Queue string `db:"queue"` // 队列名称
  62. SubmitType string `db:"submit_type"` // cmd(命令行模式)
  63. NNode string `db:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
  64. StdOutFile string `db:"std_out_file"` // 工作路径/std.err.%j
  65. StdErrFile string `db:"std_err_file"` // 工作路径/std.err.%j
  66. StdInput string `db:"std_input"`
  67. Partition string `db:"partition"`
  68. DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是)
  69. CreatedBy int64 `db:"created_by"` // 创建人
  70. CreatedTime time.Time `db:"created_time"` // 创建时间
  71. UpdatedBy int64 `db:"updated_by"` // 更新人
  72. UpdatedTime time.Time `db:"updated_time"` // 更新时间
  73. UserId int64 `db:"user_id"`
  74. }
  75. )
  76. func newTaskHpcModel(conn sqlx.SqlConn) *defaultTaskHpcModel {
  77. return &defaultTaskHpcModel{
  78. conn: conn,
  79. table: "`task_hpc`",
  80. }
  81. }
  82. func (m *defaultTaskHpcModel) Delete(ctx context.Context, id int64) error {
  83. query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
  84. _, err := m.conn.ExecCtx(ctx, query, id)
  85. return err
  86. }
  87. func (m *defaultTaskHpcModel) FindOne(ctx context.Context, id int64) (*TaskHpc, error) {
  88. query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", taskHpcRows, m.table)
  89. var resp TaskHpc
  90. err := m.conn.QueryRowCtx(ctx, &resp, query, id)
  91. switch err {
  92. case nil:
  93. return &resp, nil
  94. case sqlc.ErrNotFound:
  95. return nil, ErrNotFound
  96. default:
  97. return nil, err
  98. }
  99. }
  100. func (m *defaultTaskHpcModel) tableName() string {
  101. return m.table
  102. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.