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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Code generated by goctl. DO NOT EDIT.
  2. package model
  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. }
  61. )
  62. func newHpcModel(conn sqlx.SqlConn) *defaultHpcModel {
  63. return &defaultHpcModel{
  64. conn: conn,
  65. table: "`hpc`",
  66. }
  67. }
  68. func (m *defaultHpcModel) Delete(ctx context.Context, id int64) error {
  69. query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
  70. _, err := m.conn.ExecCtx(ctx, query, id)
  71. return err
  72. }
  73. func (m *defaultHpcModel) FindOne(ctx context.Context, id int64) (*Hpc, error) {
  74. query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", hpcRows, m.table)
  75. var resp Hpc
  76. err := m.conn.QueryRowCtx(ctx, &resp, query, id)
  77. switch err {
  78. case nil:
  79. return &resp, nil
  80. case sqlc.ErrNotFound:
  81. return nil, ErrNotFound
  82. default:
  83. return nil, err
  84. }
  85. }
  86. func (m *defaultHpcModel) FindOneByServiceNameName(ctx context.Context, serviceName sql.NullString, name sql.NullString) (*Hpc, error) {
  87. var resp Hpc
  88. query := fmt.Sprintf("select %s from %s where `service_name` = ? and `name` = ? limit 1", hpcRows, m.table)
  89. err := m.conn.QueryRowCtx(ctx, &resp, query, serviceName, name)
  90. switch err {
  91. case nil:
  92. return &resp, nil
  93. case sqlc.ErrNotFound:
  94. return nil, ErrNotFound
  95. default:
  96. return nil, err
  97. }
  98. }
  99. func (m *defaultHpcModel) tableName() string {
  100. return m.table
  101. }

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.