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 4.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. Copyright (c) [2023] [pcm]
  3. [pcm-coordinator] is licensed under Mulan PSL v2.
  4. You can use this software according to the terms and conditions of the Mulan PSL v2.
  5. You may obtain a copy of Mulan PSL v2 at:
  6. http://license.coscl.org.cn/MulanPSL2
  7. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  8. EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  9. MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  10. See the Mulan PSL v2 for more details.
  11. */
  12. package models
  13. import (
  14. "context"
  15. "database/sql"
  16. "github.com/Masterminds/squirrel"
  17. "github.com/zeromicro/go-zero/core/stores/cache"
  18. "github.com/zeromicro/go-zero/core/stores/sqlc"
  19. "github.com/zeromicro/go-zero/core/stores/sqlx"
  20. )
  21. type (
  22. centerOverviewModel interface {
  23. FindAll(ctx context.Context) (*[]CenterOverview, error)
  24. }
  25. defaultCenterOverviewModel struct {
  26. sqlc.CachedConn
  27. table string
  28. }
  29. CenterOverview struct {
  30. Id sql.NullInt64 `json:"id"`
  31. CenterSource sql.NullString `json:"centerSource"`
  32. SourceId sql.NullString `json:"sourceId"`
  33. Name sql.NullString `json:"name"`
  34. Description sql.NullString `json:"description"`
  35. Type sql.NullString `json:"type"`
  36. Area sql.NullString `json:"area"`
  37. City sql.NullString `json:"city"`
  38. Longitude sql.NullFloat64 `json:"longitude"`
  39. Latitude sql.NullFloat64 `json:"latitude"`
  40. Status sql.NullString `json:"status"`
  41. UserNum sql.NullInt64 `json:"userNum"`
  42. DeletedFlag sql.NullInt64 `json:"deletedFlag"`
  43. CloudClusterNum sql.NullInt64 `json:"cloudClusterNum"`
  44. CloudNodeNum sql.NullInt64 `json:"cloudNodeNum"`
  45. CloudCpuNum sql.NullInt64 `json:"cloudCpuNum"`
  46. CloudGpuNum sql.NullInt64 `json:"cloudGpuNum"`
  47. CloudMngFlops sql.NullInt64 `json:"cloudMngFlops"`
  48. CloudUmngFlops sql.NullInt64 `json:"cloudUmngFlops"`
  49. CloudMngStorage sql.NullInt64 `json:"CloudMngStorage"`
  50. CloudUmngStorage sql.NullInt64 `json:"CloudUmngStorage"`
  51. AiClusterNum sql.NullInt64 `json:"aiClusterNum"`
  52. AiNodeNum sql.NullInt64 `json:"aiNodeNum"`
  53. AiCpuNum sql.NullInt64 `json:"aiCpuNum"`
  54. AiGpuNum sql.NullInt64 `json:"aiGpuNum"`
  55. AiMngFlops sql.NullInt64 `json:"aiMngFlops"`
  56. AiUmngFlops sql.NullInt64 `json:"aiUmngFlops"`
  57. AiMngStorage sql.NullInt64 `json:"aiMngStorage"`
  58. AiUmngStorage sql.NullInt64 `json:"aiUmngStorage"`
  59. HpcClusterNum sql.NullInt64 `json:"hpcClusterNum"`
  60. HpcNodeNum sql.NullInt64 `json:"hpcNodeNum"`
  61. HpcCpuNum sql.NullInt64 `json:"hpcCpuNum"`
  62. HpcGpuNum sql.NullInt64 `json:"hpcGpuNum"`
  63. HpcMngFlops sql.NullInt64 `json:"hpcMngFlops"`
  64. HpcUmngFlops sql.NullInt64 `json:"hpcUmngFlops"`
  65. HpcMngStorage sql.NullInt64 `json:"hpcMngStorage"`
  66. HpcUmngStorage sql.NullInt64 `json:"hpcUmngStorage"`
  67. Edwc sql.NullBool `json:"edwc"`
  68. Ydyl sql.NullBool `json:"ydyl"`
  69. HubCode sql.NullInt64 `json:"hubCode"`
  70. }
  71. )
  72. func newCenterOverviewModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultCenterOverviewModel {
  73. return &defaultCenterOverviewModel{
  74. CachedConn: sqlc.NewConn(conn, c),
  75. table: "`compute_center`",
  76. }
  77. }
  78. func (m *defaultCenterOverviewModel) FindAll(ctx context.Context) (*[]CenterOverview, error) {
  79. var centers []CenterOverview
  80. 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`).
  81. From("compute_center cc").
  82. LeftJoin(`ai_center ac on cc.id = ac.id`).
  83. LeftJoin(`hpc_center hc on cc.id = hc.id`).
  84. LeftJoin(`cloud_center c on cc.id = c.id`).
  85. LeftJoin(`center_tag ct on cc.id = ct.id`).
  86. Where(`cc.deleted_flag = 0`)
  87. query, values, _ := centerSelect.ToSql()
  88. err := m.QueryRowsNoCacheCtx(ctx, &centers, query, values...)
  89. if err != nil {
  90. return nil, err
  91. }
  92. return &centers, nil
  93. }

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.