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.

aiinferdeployinstancemodel_gen.go 4.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. aiInferDeployInstanceFieldNames = builder.RawFieldNames(&AiInferDeployInstance{})
  15. aiInferDeployInstanceRows = strings.Join(aiInferDeployInstanceFieldNames, ",")
  16. aiInferDeployInstanceRowsExpectAutoSet = strings.Join(stringx.Remove(aiInferDeployInstanceFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
  17. aiInferDeployInstanceRowsWithPlaceHolder = strings.Join(stringx.Remove(aiInferDeployInstanceFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
  18. )
  19. type (
  20. aiInferDeployInstanceModel interface {
  21. Insert(ctx context.Context, data *AiInferDeployInstance) (sql.Result, error)
  22. FindOne(ctx context.Context, id int64) (*AiInferDeployInstance, error)
  23. Update(ctx context.Context, data *AiInferDeployInstance) error
  24. Delete(ctx context.Context, id int64) error
  25. }
  26. defaultAiInferDeployInstanceModel struct {
  27. conn sqlx.SqlConn
  28. table string
  29. }
  30. AiInferDeployInstance struct {
  31. Id int64 `db:"id" json:"id,string"`
  32. DeployInstanceTaskId int64 `db:"deploy_instance_task_id" json:"deployTaskId,string"`
  33. InstanceId string `db:"instance_id" json:"instanceId"`
  34. InstanceName string `db:"instance_name" json:"instanceName"`
  35. AdapterId int64 `db:"adapter_id" json:"adapterId,string"`
  36. AdapterName string `db:"adapter_name" json:"adapterName" `
  37. ClusterId int64 `db:"cluster_id" json:"clusterId,string"`
  38. ClusterName string `db:"cluster_name" json:"clusterName"`
  39. ModelName string `db:"model_name" json:"modelName"`
  40. ModelType string `db:"model_type" json:"modelType"`
  41. InferCard string `db:"infer_card" json:"inferCard"`
  42. Status string `db:"status" json:"status"`
  43. CreateTime string `db:"create_time" json:"createTime"`
  44. UpdateTime string `db:"update_time" json:"updateTime"`
  45. ClusterType string `db:"cluster_type" json:"clusterType"`
  46. }
  47. )
  48. func newAiInferDeployInstanceModel(conn sqlx.SqlConn) *defaultAiInferDeployInstanceModel {
  49. return &defaultAiInferDeployInstanceModel{
  50. conn: conn,
  51. table: "`ai_infer_deploy_instance`",
  52. }
  53. }
  54. func (m *defaultAiInferDeployInstanceModel) withSession(session sqlx.Session) *defaultAiInferDeployInstanceModel {
  55. return &defaultAiInferDeployInstanceModel{
  56. conn: sqlx.NewSqlConnFromSession(session),
  57. table: "`ai_infer_deploy_instance`",
  58. }
  59. }
  60. func (m *defaultAiInferDeployInstanceModel) Delete(ctx context.Context, id int64) error {
  61. query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
  62. _, err := m.conn.ExecCtx(ctx, query, id)
  63. return err
  64. }
  65. func (m *defaultAiInferDeployInstanceModel) FindOne(ctx context.Context, id int64) (*AiInferDeployInstance, error) {
  66. query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", aiInferDeployInstanceRows, m.table)
  67. var resp AiInferDeployInstance
  68. err := m.conn.QueryRowCtx(ctx, &resp, query, id)
  69. switch err {
  70. case nil:
  71. return &resp, nil
  72. case sqlc.ErrNotFound:
  73. return nil, ErrNotFound
  74. default:
  75. return nil, err
  76. }
  77. }
  78. func (m *defaultAiInferDeployInstanceModel) Insert(ctx context.Context, data *AiInferDeployInstance) (sql.Result, error) {
  79. query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, aiInferDeployInstanceRowsExpectAutoSet)
  80. ret, err := m.conn.ExecCtx(ctx, query, data.InstanceId, data.InstanceName, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.ModelName, data.ModelType, data.InferCard, data.Status)
  81. return ret, err
  82. }
  83. func (m *defaultAiInferDeployInstanceModel) Update(ctx context.Context, data *AiInferDeployInstance) error {
  84. query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, aiInferDeployInstanceRowsWithPlaceHolder)
  85. _, err := m.conn.ExecCtx(ctx, query, data.InstanceId, data.InstanceName, data.AdapterId, data.AdapterName, data.ClusterId, data.ClusterName, data.ModelName, data.ModelType, data.InferCard, data.Status, data.Id)
  86. return err
  87. }
  88. func (m *defaultAiInferDeployInstanceModel) tableName() string {
  89. return m.table
  90. }

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.