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.

taskaiasynchronousmodel_gen.go 4.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Code generated by goctl. DO NOT EDIT.
  2. package models
  3. import (
  4. "context"
  5. "database/sql"
  6. "fmt"
  7. "strings"
  8. "github.com/zeromicro/go-zero/core/stores/builder"
  9. "github.com/zeromicro/go-zero/core/stores/sqlx"
  10. "github.com/zeromicro/go-zero/core/stringx"
  11. )
  12. var (
  13. taskAiAsynchronousFieldNames = builder.RawFieldNames(&TaskAiAsynchronous{})
  14. taskAiAsynchronousRows = strings.Join(taskAiAsynchronousFieldNames, ",")
  15. taskAiAsynchronousRowsExpectAutoSet = strings.Join(stringx.Remove(taskAiAsynchronousFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
  16. taskAiAsynchronousRowsWithPlaceHolder = strings.Join(stringx.Remove(taskAiAsynchronousFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
  17. )
  18. type (
  19. taskAiAsynchronousModel interface {
  20. Insert(ctx context.Context, data *TaskAiAsynchronous) (sql.Result, error)
  21. FindOne(ctx context.Context, id int64) (*TaskAiAsynchronous, error)
  22. Update(ctx context.Context, data *TaskAiAsynchronous) error
  23. Delete(ctx context.Context, id int64) error
  24. }
  25. defaultTaskAiAsynchronousModel struct {
  26. conn sqlx.SqlConn
  27. table string
  28. }
  29. TaskAiAsynchronous struct {
  30. Id int64 `db:"id"` // 训练作业资源规格id
  31. TaskId int64 `db:"task_id"` // 任务id
  32. AdapterId int64 `db:"adapter_id"` // 执行任务的适配器id
  33. AdapterName string `db:"adapter_name"` // 适配器名称
  34. ClusterId int64 `db:"cluster_id"` // 集群id
  35. ClusterName string `db:"cluster_name"` // 集群名称
  36. Name string `db:"name"` // 任务名
  37. Replica int64 `db:"replica"` // 执行数
  38. JobId string `db:"job_id"` // 集群返回任务id
  39. StartTime string `db:"start_time"` // 开始时间
  40. RunningTime string `db:"running_time"` // 运行时间
  41. Result string `db:"result"` // 运行结果
  42. DeletedAt string `db:"deleted_at"` // 删除时间
  43. ImageId string `db:"image_id"` // 镜像id
  44. Command string `db:"command"` // 命令行
  45. FlavorId string `db:"flavor_id"` // 训练作业资源规格id
  46. Status string `db:"status"` // 任务状态
  47. }
  48. )
  49. func newTaskAiAsynchronousModel(conn sqlx.SqlConn) *defaultTaskAiAsynchronousModel {
  50. return &defaultTaskAiAsynchronousModel{
  51. conn: conn,
  52. table: "`task_ai_asynchronous`",
  53. }
  54. }
  55. func (m *defaultTaskAiAsynchronousModel) Delete(ctx context.Context, id int64) error {
  56. query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
  57. _, err := m.conn.ExecCtx(ctx, query, id)
  58. return err
  59. }
  60. func (m *defaultTaskAiAsynchronousModel) FindOne(ctx context.Context, id int64) (*TaskAiAsynchronous, error) {
  61. query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", taskAiAsynchronousRows, m.table)
  62. var resp TaskAiAsynchronous
  63. err := m.conn.QueryRowCtx(ctx, &resp, query, id)
  64. switch err {
  65. case nil:
  66. return &resp, nil
  67. case sqlx.ErrNotFound:
  68. return nil, ErrNotFound
  69. default:
  70. return nil, err
  71. }
  72. }
  73. func (m *defaultTaskAiAsynchronousModel) Insert(ctx context.Context, data *TaskAiAsynchronous) (sql.Result, error) {
  74. query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, taskAiAsynchronousRowsExpectAutoSet)
  75. ret, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.Name, data.Replica, data.JobId, data.StartTime, data.RunningTime, data.Result, data.DeletedAt, data.ImageId, data.Command, data.FlavorId, data.Status)
  76. return ret, err
  77. }
  78. func (m *defaultTaskAiAsynchronousModel) Update(ctx context.Context, data *TaskAiAsynchronous) error {
  79. query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, taskAiAsynchronousRowsWithPlaceHolder)
  80. _, err := m.conn.ExecCtx(ctx, query, data.TaskId, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.Name, data.Replica, data.JobId, data.StartTime, data.RunningTime, data.Result, data.DeletedAt, data.ImageId, data.Command, data.FlavorId, data.Status, data.Id)
  81. return err
  82. }
  83. func (m *defaultTaskAiAsynchronousModel) tableName() string {
  84. return m.table
  85. }

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.