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.

hpcmodel_gen.go 4.3 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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/sqlc"
  10. "github.com/zeromicro/go-zero/core/stores/sqlx"
  11. "github.com/zeromicro/go-zero/core/stringx"
  12. )
  13. var (
  14. hpcFieldNames = builder.RawFieldNames(&Hpc{})
  15. hpcRows = strings.Join(hpcFieldNames, ",")
  16. hpcRowsExpectAutoSet = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
  17. hpcRowsWithPlaceHolder = strings.Join(stringx.Remove(hpcFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
  18. )
  19. type (
  20. hpcModel interface {
  21. Insert(ctx context.Context, data *Hpc) (sql.Result, error)
  22. FindOne(ctx context.Context, id int64) (*Hpc, error)
  23. FindOneByServiceNameName(ctx context.Context, serviceName sql.NullString, name sql.NullString) (*Hpc, error)
  24. Update(ctx context.Context, data *Hpc) error
  25. Delete(ctx context.Context, id int64) error
  26. }
  27. defaultHpcModel struct {
  28. conn sqlx.SqlConn
  29. table string
  30. }
  31. Hpc struct {
  32. Id int64 `db:"id"` // id
  33. TaskId int64 `db:"task_id"` // 任务id
  34. ParticipantId int64 `db:"participant_id"` // 集群静态信息id
  35. JobId string `db:"job_id"` // 作业id
  36. Name string `db:"name"` // 名称
  37. Status string `db:"status"` // 状态
  38. StartTime string `db:"start_time"` // 开始时间
  39. RunningTime int64 `db:"running_time"` // 运行时间
  40. CardCount int64 `db:"card_count"` // 卡数
  41. CreatedBy int64 `db:"created_by"` // 创建人
  42. CreatedTime sql.NullTime `db:"created_time"` // 创建时间
  43. UpdatedBy int64 `db:"updated_by"` // 更新人
  44. UpdatedTime sql.NullTime `db:"updated_time"` // 更新时间
  45. DeletedFlag int64 `db:"deleted_flag"` // 是否删除(0-否,1-是)
  46. WorkDir string `db:"work_dir"`
  47. WallTime string `db:"wall_time"`
  48. Result string `db:"result"`
  49. YamlString string `db:"yaml_string"`
  50. CmdScript string `db:"cmd_script"`
  51. //DerivedEs string `db:"derived_es"`
  52. //Cluster string `db:"cluster"`
  53. //BlockId string `db:"block_id"`
  54. //AllocNodes uint32 `db:"alloc_nodes"`
  55. //AllocCpu uint32 `db:"alloc_cpu"`
  56. //Version string `db:"version"`
  57. //Account string `db:"account"`
  58. //ExitCode uint32 `db:"exit_code"`
  59. //AssocId uint32 `db:"assoc_id"`
  60. AppType string `db:"app_type"`
  61. AppName string `db:"app_name"`
  62. Queue string `db:"queue"`
  63. SubmitType string `db:"submit_type"`
  64. NNode string `db:"n_node"`
  65. StdOutFile string `db:"std_out_file"`
  66. StdErrFile string `db:"std_err_file"`
  67. }
  68. )
  69. func newHpcModel(conn sqlx.SqlConn) *defaultHpcModel {
  70. return &defaultHpcModel{
  71. conn: conn,
  72. table: "`hpc`",
  73. }
  74. }
  75. func (m *defaultHpcModel) Delete(ctx context.Context, id int64) error {
  76. query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
  77. _, err := m.conn.ExecCtx(ctx, query, id)
  78. return err
  79. }
  80. func (m *defaultHpcModel) FindOne(ctx context.Context, id int64) (*Hpc, error) {
  81. query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table)
  82. var resp Hpc
  83. err := m.conn.QueryRowCtx(ctx, &resp, query, id)
  84. switch err {
  85. case nil:
  86. return &resp, nil
  87. case sqlc.ErrNotFound:
  88. return nil, ErrNotFound
  89. default:
  90. return nil, err
  91. }
  92. }
  93. func (m *defaultHpcModel) FindOneByServiceNameName(ctx context.Context, serviceName sql.NullString, name sql.NullString) (*Hpc, error) {
  94. var resp Hpc
  95. query := fmt.Sprintf("select %s from %s where `service_name` = ? and `name` = ? limit 1", hpcRows, m.table)
  96. err := m.conn.QueryRowCtx(ctx, &resp, query, serviceName, name)
  97. switch err {
  98. case nil:
  99. return &resp, nil
  100. case sqlc.ErrNotFound:
  101. return nil, ErrNotFound
  102. default:
  103. return nil, err
  104. }
  105. }
  106. func (m *defaultHpcModel) tableName() string {
  107. return m.table
  108. }

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.