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.

centerOverviewModel_gen.go 3.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package models
  2. import (
  3. "context"
  4. "database/sql"
  5. "github.com/Masterminds/squirrel"
  6. "github.com/zeromicro/go-zero/core/stores/cache"
  7. "github.com/zeromicro/go-zero/core/stores/sqlc"
  8. "github.com/zeromicro/go-zero/core/stores/sqlx"
  9. )
  10. type (
  11. centerOverviewModel interface {
  12. FindAll(ctx context.Context) (*[]CenterOverview, error)
  13. }
  14. defaultCenterOverviewModel struct {
  15. sqlc.CachedConn
  16. table string
  17. }
  18. CenterOverview struct {
  19. Id sql.NullInt64 `json:"id"`
  20. CenterSource sql.NullString `json:"centerSource"`
  21. SourceId sql.NullString `json:"sourceId"`
  22. Name sql.NullString `json:"name"`
  23. Description sql.NullString `json:"description"`
  24. Type sql.NullString `json:"type"`
  25. Area sql.NullString `json:"area"`
  26. City sql.NullString `json:"city"`
  27. Longitude sql.NullFloat64 `json:"longitude"`
  28. Latitude sql.NullFloat64 `json:"latitude"`
  29. Status sql.NullString `json:"status"`
  30. UserNum sql.NullInt64 `json:"userNum"`
  31. DeletedFlag sql.NullInt64 `json:"deletedFlag"`
  32. CloudClusterNum sql.NullInt64 `json:"cloudClusterNum"`
  33. CloudNodeNum sql.NullInt64 `json:"cloudNodeNum"`
  34. CloudCpuNum sql.NullInt64 `json:"cloudCpuNum"`
  35. CloudGpuNum sql.NullInt64 `json:"cloudGpuNum"`
  36. CloudMngFlops sql.NullInt64 `json:"cloudMngFlops"`
  37. CloudUmngFlops sql.NullInt64 `json:"cloudUmngFlops"`
  38. CloudMngStorage sql.NullInt64 `json:"CloudMngStorage"`
  39. CloudUmngStorage sql.NullInt64 `json:"CloudUmngStorage"`
  40. AiClusterNum sql.NullInt64 `json:"aiClusterNum"`
  41. AiNodeNum sql.NullInt64 `json:"aiNodeNum"`
  42. AiCpuNum sql.NullInt64 `json:"aiCpuNum"`
  43. AiGpuNum sql.NullInt64 `json:"aiGpuNum"`
  44. AiMngFlops sql.NullInt64 `json:"aiMngFlops"`
  45. AiUmngFlops sql.NullInt64 `json:"aiUmngFlops"`
  46. AiMngStorage sql.NullInt64 `json:"aiMngStorage"`
  47. AiUmngStorage sql.NullInt64 `json:"aiUmngStorage"`
  48. HpcClusterNum sql.NullInt64 `json:"hpcClusterNum"`
  49. HpcNodeNum sql.NullInt64 `json:"hpcNodeNum"`
  50. HpcCpuNum sql.NullInt64 `json:"hpcCpuNum"`
  51. HpcGpuNum sql.NullInt64 `json:"hpcGpuNum"`
  52. HpcMngFlops sql.NullInt64 `json:"hpcMngFlops"`
  53. HpcUmngFlops sql.NullInt64 `json:"hpcUmngFlops"`
  54. HpcMngStorage sql.NullInt64 `json:"hpcMngStorage"`
  55. HpcUmngStorage sql.NullInt64 `json:"hpcUmngStorage"`
  56. Edwc sql.NullBool `json:"edwc"`
  57. Ydyl sql.NullBool `json:"ydyl"`
  58. HubCode sql.NullInt64 `json:"hubCode"`
  59. }
  60. )
  61. func newCenterOverviewModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultCenterOverviewModel {
  62. return &defaultCenterOverviewModel{
  63. CachedConn: sqlc.NewConn(conn, c),
  64. table: "`compute_center`",
  65. }
  66. }
  67. func (m *defaultCenterOverviewModel) FindAll(ctx context.Context) (*[]CenterOverview, error) {
  68. var centers []CenterOverview
  69. centerSelect := squirrel.Select(`cc.*`, `ac.cluster_num`, `ac.node_num`, `ac.cpu_num`, `ac.gpu_num`, `ac.managed_flops`, `ac.unmanaged_flops`, `ac.managed_storage`, `ac.unmanaged_storage`, `hc.cluster_num`, `c.node_num`, `hc.cpu_num`, `hc.gpu_num`, `hc.managed_flops`, `hc.unmanaged_flops`, `hc.managed_storage`, `hc.unmanaged_storage`, `c.cluster_num`, `c.node_num`, `c.cpu_num`, `c.gpu_num`, `c.managed_flops`, `c.unmanaged_flops`, `c.managed_storage`, `c.unmanaged_storage`, `ct.edwc`, `ct.ydyl`).
  70. From("compute_center cc").
  71. LeftJoin(`ai_center ac on cc.id = ac.id`).
  72. LeftJoin(`hpc_center hc on cc.id = hc.id`).
  73. LeftJoin(`cloud_center c on cc.id = c.id`).
  74. LeftJoin(`center_tag ct on cc.id = ct.id`).
  75. Where(`cc.deleted_flag = 0`)
  76. query, values, _ := centerSelect.ToSql()
  77. err := m.QueryRowsNoCacheCtx(ctx, &centers, query, values...)
  78. if err != nil {
  79. return nil, err
  80. }
  81. return &centers, nil
  82. }

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.