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.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. Backend string `db:"backend"` // 平台类型
  41. OperateType string `db:"operate_type"` // 操作类型
  42. Status string `db:"status"` // 状态
  43. CmdScript string `db:"cmd_script"`
  44. StartTime string `db:"start_time"` // 开始时间
  45. EndTime string `db:"end_time"` // 结束时间
  46. RunningTime int64 `db:"running_time"` // 运行时间
  47. DerivedEs string `db:"derived_es"`
  48. Cluster string `db:"cluster"`
  49. BlockId int64 `db:"block_id"`
  50. AllocNodes int64 `db:"alloc_nodes"`
  51. AllocCpu int64 `db:"alloc_cpu"`
  52. CardCount int64 `db:"card_count"` // 卡数
  53. Version string `db:"version"`
  54. Account string `db:"account"`
  55. WorkDir string `db:"work_dir"` // 工作路径
  56. AssocId int64 `db:"assoc_id"`
  57. ExitCode int64 `db:"exit_code"`
  58. WallTime string `db:"wall_time"` // 最大运行时间
  59. Result string `db:"result"` // 运行结果
  60. DeletedAt sql.NullTime `db:"deleted_at"` // 删除时间
  61. YamlString string `db:"yaml_string"`
  62. AppType string `db:"app_type"` // 应用类型
  63. AppName string `db:"app_name"` // 应用名称
  64. Queue string `db:"queue"` // 队列名称
  65. SubmitType string `db:"submit_type"` // cmd(命令行模式)
  66. NNode string `db:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"")
  67. StdOutFile string `db:"std_out_file"` // 工作路径/std.err.%j
  68. StdErrFile string `db:"std_err_file"` // 工作路径/std.err.%j
  69. StdInput string `db:"std_input"`
  70. Partition string `db:"partition"`
  71. DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是)
  72. CreatedBy int64 `db:"created_by"` // 创建人
  73. CreatedTime time.Time `db:"created_time"` // 创建时间
  74. UpdatedBy int64 `db:"updated_by"` // 更新人
  75. UpdatedTime time.Time `db:"updated_time"` // 更新时间
  76. UserId int64 `db:"user_id"`
  77. TimeLimit int64 `db:"time_limit"`
  78. Params string `db:"params"` // 渲染参数
  79. Script string `db:"script"` // 生成的脚本
  80. TemplateId int64 `db:"template_id"` // 模板ID
  81. }
  82. )
  83. func newTaskHpcModel(conn sqlx.SqlConn) *defaultTaskHpcModel {
  84. return &defaultTaskHpcModel{
  85. conn: conn,
  86. table: "`task_hpc`",
  87. }
  88. }
  89. func (m *defaultTaskHpcModel) Delete(ctx context.Context, id int64) error {
  90. query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
  91. _, err := m.conn.ExecCtx(ctx, query, id)
  92. return err
  93. }
  94. func (m *defaultTaskHpcModel) FindOne(ctx context.Context, id int64) (*TaskHpc, error) {
  95. query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", taskHpcRows, m.table)
  96. var resp TaskHpc
  97. err := m.conn.QueryRowCtx(ctx, &resp, query, id)
  98. switch err {
  99. case nil:
  100. return &resp, nil
  101. case sqlc.ErrNotFound:
  102. return nil, ErrNotFound
  103. default:
  104. return nil, err
  105. }
  106. }
  107. func (m *defaultTaskHpcModel) tableName() string {
  108. return m.table
  109. }

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.