diff --git a/api/desc/pcm.api b/api/desc/pcm.api index 6e786ba3..0dabdee0 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -549,21 +549,21 @@ service pcm { @doc "删除应用" @handler DeleteAppByAppName - get /apps/deleteApp (DeleteAppReq) returns (DeleteAppResp) + delete /apps/deleteApp (DeleteAppReq) returns (DeleteAppResp) @doc "更新应用" @handler UpdateAppByAppName - get /apps/updateApp (DeleteAppReq) returns (AppTaskResp) + put /apps/updateApp (DeleteAppReq) returns (AppTaskResp) @doc "重启应用" @handler RestartAppByAppName - get /apps/restartApp (DeleteAppReq) returns (AppTaskResp) + put /apps/restartApp (DeleteAppReq) returns (AppTaskResp) @doc "暂停应用" @handler PauseAppByAppName - get /apps/pauseApp (DeleteAppReq) returns (AppTaskResp) + put /apps/pauseApp (DeleteAppReq) returns (AppTaskResp) @doc "启动应用" @handler StartAppByAppName - get /apps/startApp (DeleteAppReq) returns (AppTaskResp) + put /apps/startApp (DeleteAppReq) returns (AppTaskResp) } \ No newline at end of file diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go index 1219566a..399b343c 100644 --- a/api/internal/handler/apps/deleteappbyappnamehandler.go +++ b/api/internal/handler/apps/deleteappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.DeleteAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go index 976ba2a1..18da48f3 100644 --- a/api/internal/handler/apps/pauseappbyappnamehandler.go +++ b/api/internal/handler/apps/pauseappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" + "net/http" ) func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.PauseAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go index 4af34ccd..611cdc4e 100644 --- a/api/internal/handler/apps/restartappbyappnamehandler.go +++ b/api/internal/handler/apps/restartappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" + "net/http" ) func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.RestartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go index 5a10a4f4..0bcff326 100644 --- a/api/internal/handler/apps/startappbyappnamehandler.go +++ b/api/internal/handler/apps/startappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" + "net/http" ) func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.StartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go index 2cdad9a1..7c8e3cb5 100644 --- a/api/internal/handler/apps/updateappbyappnamehandler.go +++ b/api/internal/handler/apps/updateappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.UpdateAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index 6960624b..bc66b888 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -660,27 +660,27 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Handler: apps.GetAppByAppNameHandler(serverCtx), }, { - Method: http.MethodGet, + Method: http.MethodDelete, Path: "/apps/deleteApp", Handler: apps.DeleteAppByAppNameHandler(serverCtx), }, { - Method: http.MethodGet, + Method: http.MethodPut, Path: "/apps/updateApp", Handler: apps.UpdateAppByAppNameHandler(serverCtx), }, { - Method: http.MethodGet, + Method: http.MethodPut, Path: "/apps/restartApp", Handler: apps.RestartAppByAppNameHandler(serverCtx), }, { - Method: http.MethodGet, + Method: http.MethodPut, Path: "/apps/pauseApp", Handler: apps.PauseAppByAppNameHandler(serverCtx), }, { - Method: http.MethodGet, + Method: http.MethodPut, Path: "/apps/startApp", Handler: apps.StartAppByAppNameHandler(serverCtx), }, diff --git a/api/internal/logic/apps/deleteappbyappnamelogic.go b/api/internal/logic/apps/deleteappbyappnamelogic.go index b73c2fb0..b556e3d6 100644 --- a/api/internal/logic/apps/deleteappbyappnamelogic.go +++ b/api/internal/logic/apps/deleteappbyappnamelogic.go @@ -2,13 +2,11 @@ package apps import ( "context" + "github.com/zeromicro/go-zero/core/logx" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" - "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/utils" - "gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes/kubernetes" - "gorm.io/gorm" - - "github.com/zeromicro/go-zero/core/logx" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/constants" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" ) type DeleteAppByAppNameLogic struct { @@ -25,24 +23,6 @@ func NewDeleteAppByAppNameLogic(ctx context.Context, svcCtx *svc.ServiceContext) } } -type Cloud struct { - Id int64 `db:"id"` // id - TaskId int64 `db:"task_id"` // 任务id - ParticipantId int64 `db:"participant_id"` // 集群静态信息id - ApiVersion string `db:"api_version"` //api版本 - Name string `db:"name"` // 名称 - Namespace string `db:"namespace"` // 命名空间 - Kind string `db:"kind"` // 种类 - Status string `db:"status"` // 状态 - StartTime string `db:"start_time"` // 开始时间 - RunningTime int64 `db:"running_time"` // 运行时长 - DeletedAt gorm.DeletedAt `gorm:"index"` - YamlString string `db:"yaml_string"` - Result string `db:"result"` // 运行结果 - NsID string `db:"ns_id"` - Replica int32 `db:"replica"` -} - func (l *DeleteAppByAppNameLogic) DeleteAppByAppName(req *types.DeleteAppReq) (resp *types.DeleteAppResp, err error) { resp = &types.DeleteAppResp{} var task = &Task{} @@ -53,26 +33,17 @@ func (l *DeleteAppByAppNameLogic) DeleteAppByAppName(req *types.DeleteAppReq) (r resp.Msg = "App not fount" return resp, err } - var clouds []Cloud - l.svcCtx.DbEngin.Raw(`select * from cloud where task_id= ? `, task.Id).Scan(&clouds) - for _, cloud := range clouds { - toYaml := utils.StringToYaml(cloud.YamlString) - //调用p端接口查询应用详情 - _, err = l.svcCtx.K8sRpc.DeleteYaml(context.Background(), &kubernetes.ApplyReq{ - YamlString: *toYaml, - }) + //删除主任务信息 + l.svcCtx.DbEngin.Model(&models.Task{}).Where("id", task.Id).Update("status", "Deleted") + tx := l.svcCtx.DbEngin.Delete(&models.Task{}, task.Id) + if tx.Error != nil { + return nil, tx.Error } - - if err != nil { - logx.Errorf("调用p端接口删除应用失败,err:%v", err) - resp.Code = 500 - resp.Msg = err.Error() - return resp, nil + // 将子任务状态修改为待删除 + tx = l.svcCtx.DbEngin.Model(&models.Cloud{}).Where("task_id", task.Id).Update("status", constants.WaitDelete) + l.svcCtx.DbEngin.Where("task_id = ?", task.Id).Delete(&models.Cloud{}) + if tx.Error != nil { + return nil, tx.Error } - //删除task跟cloud表数据 - l.svcCtx.DbEngin.Delete(&Task{}, task.Id) - l.svcCtx.DbEngin.Delete(&Cloud{}, task.Id).Where("task_id = ?", task.Id) - resp.Code = 200 - resp.Msg = "succeed" return } diff --git a/deploy/goctl/1.5.3/api/route-addition.tpl b/deploy/goctl/1.5.3/api/route-addition.tpl deleted file mode 100644 index ec9edf0d..00000000 --- a/deploy/goctl/1.5.3/api/route-addition.tpl +++ /dev/null @@ -1,4 +0,0 @@ - - server.AddRoutes( - {{.routes}} {{.jwt}}{{.signature}} {{.prefix}} {{.timeout}} - ) diff --git a/deploy/goctl/1.5.3/model/model-new.tpl b/deploy/goctl/1.5.3/model/model-new.tpl deleted file mode 100644 index c73ab593..00000000 --- a/deploy/goctl/1.5.3/model/model-new.tpl +++ /dev/null @@ -1,6 +0,0 @@ -func new{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf{{end}}) *default{{.upperStartCamelObject}}Model { - return &default{{.upperStartCamelObject}}Model{ - {{if .withCache}}CachedConn: sqlc.NewConn(conn, c){{else}}conn:conn{{end}}, - table: {{.table}}, - } -} diff --git a/deploy/goctl/1.5.3/api/config.tpl b/deploy/goctl/api/config.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/config.tpl rename to deploy/goctl/api/config.tpl diff --git a/deploy/goctl/1.5.3/api/context.tpl b/deploy/goctl/api/context.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/context.tpl rename to deploy/goctl/api/context.tpl diff --git a/deploy/goctl/1.5.3/api/etc.tpl b/deploy/goctl/api/etc.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/etc.tpl rename to deploy/goctl/api/etc.tpl diff --git a/deploy/goctl/1.5.3/api/handler.tpl b/deploy/goctl/api/handler.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/handler.tpl rename to deploy/goctl/api/handler.tpl diff --git a/deploy/goctl/1.5.3/api/logic.tpl b/deploy/goctl/api/logic.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/logic.tpl rename to deploy/goctl/api/logic.tpl diff --git a/deploy/goctl/1.5.3/api/main.tpl b/deploy/goctl/api/main.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/main.tpl rename to deploy/goctl/api/main.tpl diff --git a/deploy/goctl/1.5.3/api/middleware.tpl b/deploy/goctl/api/middleware.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/middleware.tpl rename to deploy/goctl/api/middleware.tpl diff --git a/deploy/goctl/api/route-addition.tpl b/deploy/goctl/api/route-addition.tpl new file mode 100644 index 00000000..bb8a5dfe --- /dev/null +++ b/deploy/goctl/api/route-addition.tpl @@ -0,0 +1,4 @@ + + server.AddRoutes( + {{.routes}} {{.jwt}}{{.signature}} {{.prefix}} {{.timeout}} {{.maxBytes}} + ) diff --git a/deploy/goctl/1.5.3/api/routes.tpl b/deploy/goctl/api/routes.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/routes.tpl rename to deploy/goctl/api/routes.tpl diff --git a/deploy/goctl/1.5.3/api/template.tpl b/deploy/goctl/api/template.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/template.tpl rename to deploy/goctl/api/template.tpl diff --git a/deploy/goctl/1.5.3/api/types.tpl b/deploy/goctl/api/types.tpl similarity index 100% rename from deploy/goctl/1.5.3/api/types.tpl rename to deploy/goctl/api/types.tpl diff --git a/deploy/goctl/1.5.3/docker/docker.tpl b/deploy/goctl/docker/docker.tpl similarity index 100% rename from deploy/goctl/1.5.3/docker/docker.tpl rename to deploy/goctl/docker/docker.tpl diff --git a/deploy/goctl/gateway/etc.tpl b/deploy/goctl/gateway/etc.tpl new file mode 100644 index 00000000..0a70f1ac --- /dev/null +++ b/deploy/goctl/gateway/etc.tpl @@ -0,0 +1,18 @@ +Name: gateway-example # gateway name +Host: localhost # gateway host +Port: 8888 # gateway port +Upstreams: # upstreams + - Grpc: # grpc upstream + Target: 0.0.0.0:8080 # grpc target,the direct grpc server address,for only one node +# Endpoints: [0.0.0.0:8080,192.168.120.1:8080] # grpc endpoints, the grpc server address list, for multiple nodes +# Etcd: # etcd config, if you want to use etcd to discover the grpc server address +# Hosts: [127.0.0.1:2378,127.0.0.1:2379] # etcd hosts +# Key: greet.grpc # the discovery key + # protoset mode + ProtoSets: + - hello.pb + # Mappings can also be written in proto options +# Mappings: # routes mapping +# - Method: get +# Path: /ping +# RpcPath: hello.Hello/Ping diff --git a/deploy/goctl/gateway/main.tpl b/deploy/goctl/gateway/main.tpl new file mode 100644 index 00000000..62734516 --- /dev/null +++ b/deploy/goctl/gateway/main.tpl @@ -0,0 +1,20 @@ +package main + +import ( + "flag" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/gateway" +) + +var configFile = flag.String("f", "etc/gateway.yaml", "config file") + +func main() { + flag.Parse() + + var c gateway.GatewayConf + conf.MustLoad(*configFile, &c) + gw := gateway.MustNewServer(c) + defer gw.Stop() + gw.Start() +} diff --git a/deploy/goctl/1.5.3/kube/deployment.tpl b/deploy/goctl/kube/deployment.tpl similarity index 91% rename from deploy/goctl/1.5.3/kube/deployment.tpl rename to deploy/goctl/kube/deployment.tpl index 95c698cb..14145df2 100644 --- a/deploy/goctl/1.5.3/kube/deployment.tpl +++ b/deploy/goctl/kube/deployment.tpl @@ -70,7 +70,7 @@ spec: --- -apiVersion: autoscaling/v2beta1 +apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler metadata: name: {{.Name}}-hpa-c @@ -88,11 +88,13 @@ spec: - type: Resource resource: name: cpu - targetAverageUtilization: 80 + target: + type: Utilization + averageUtilization: 80 --- -apiVersion: autoscaling/v2beta1 +apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler metadata: name: {{.Name}}-hpa-m @@ -110,4 +112,6 @@ spec: - type: Resource resource: name: memory - targetAverageUtilization: 80 + target: + type: Utilization + averageUtilization: 80 diff --git a/deploy/goctl/1.5.3/kube/job.tpl b/deploy/goctl/kube/job.tpl similarity index 100% rename from deploy/goctl/1.5.3/kube/job.tpl rename to deploy/goctl/kube/job.tpl diff --git a/deploy/goctl/1.5.3/model/delete.tpl b/deploy/goctl/model/delete.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/delete.tpl rename to deploy/goctl/model/delete.tpl diff --git a/deploy/goctl/1.5.3/model/err.tpl b/deploy/goctl/model/err.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/err.tpl rename to deploy/goctl/model/err.tpl diff --git a/deploy/goctl/1.5.3/model/field.tpl b/deploy/goctl/model/field.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/field.tpl rename to deploy/goctl/model/field.tpl diff --git a/deploy/goctl/1.5.3/model/find-one-by-field-extra-method.tpl b/deploy/goctl/model/find-one-by-field-extra-method.tpl similarity index 80% rename from deploy/goctl/1.5.3/model/find-one-by-field-extra-method.tpl rename to deploy/goctl/model/find-one-by-field-extra-method.tpl index f6d695af..7e1df69d 100644 --- a/deploy/goctl/1.5.3/model/find-one-by-field-extra-method.tpl +++ b/deploy/goctl/model/find-one-by-field-extra-method.tpl @@ -1,8 +1,8 @@ -func (m *default{{.upperStartCamelObject}}Model) formatPrimary(primary interface{}) string { +func (m *default{{.upperStartCamelObject}}Model) formatPrimary(primary any) string { return fmt.Sprintf("%s%v", {{.primaryKeyLeft}}, primary) } -func (m *default{{.upperStartCamelObject}}Model) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error { +func (m *default{{.upperStartCamelObject}}Model) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { query := fmt.Sprintf("select %s from %s where {{.originalPrimaryField}} = {{if .postgreSql}}$1{{else}}?{{end}} limit 1", {{.lowerStartCamelObject}}Rows, m.table ) return conn.QueryRowCtx(ctx, v, query, primary) } diff --git a/deploy/goctl/1.5.3/model/find-one-by-field.tpl b/deploy/goctl/model/find-one-by-field.tpl similarity index 91% rename from deploy/goctl/1.5.3/model/find-one-by-field.tpl rename to deploy/goctl/model/find-one-by-field.tpl index 226502d6..390fb01c 100644 --- a/deploy/goctl/1.5.3/model/find-one-by-field.tpl +++ b/deploy/goctl/model/find-one-by-field.tpl @@ -1,7 +1,7 @@ func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}(ctx context.Context, {{.in}}) (*{{.upperStartCamelObject}}, error) { {{if .withCache}}{{.cacheKey}} var resp {{.upperStartCamelObject}} - err := m.QueryRowIndexCtx(ctx, &resp, {{.cacheKeyVariable}}, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) (i interface{}, e error) { + err := m.QueryRowIndexCtx(ctx, &resp, {{.cacheKeyVariable}}, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { query := fmt.Sprintf("select %s from %s where {{.originalField}} limit 1", {{.lowerStartCamelObject}}Rows, m.table) if err := conn.QueryRowCtx(ctx, &resp, query, {{.lowerStartCamelField}}); err != nil { return nil, err diff --git a/deploy/goctl/1.5.3/model/find-one.tpl b/deploy/goctl/model/find-one.tpl similarity index 94% rename from deploy/goctl/1.5.3/model/find-one.tpl rename to deploy/goctl/model/find-one.tpl index 4e68b34d..a8085580 100644 --- a/deploy/goctl/1.5.3/model/find-one.tpl +++ b/deploy/goctl/model/find-one.tpl @@ -1,7 +1,7 @@ func (m *default{{.upperStartCamelObject}}Model) FindOne(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error) { {{if .withCache}}{{.cacheKey}} var resp {{.upperStartCamelObject}} - err := m.QueryRowCtx(ctx, &resp, {{.cacheKeyVariable}}, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error { + err := m.QueryRowCtx(ctx, &resp, {{.cacheKeyVariable}}, func(ctx context.Context, conn sqlx.SqlConn, v any) error { query := fmt.Sprintf("select %s from %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}} limit 1", {{.lowerStartCamelObject}}Rows, m.table) return conn.QueryRowCtx(ctx, v, query, {{.lowerStartCamelPrimaryKey}}) }) diff --git a/deploy/goctl/1.5.3/model/import-no-cache.tpl b/deploy/goctl/model/import-no-cache.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/import-no-cache.tpl rename to deploy/goctl/model/import-no-cache.tpl diff --git a/deploy/goctl/1.5.3/model/import.tpl b/deploy/goctl/model/import.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/import.tpl rename to deploy/goctl/model/import.tpl diff --git a/deploy/goctl/1.5.3/model/insert.tpl b/deploy/goctl/model/insert.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/insert.tpl rename to deploy/goctl/model/insert.tpl diff --git a/deploy/goctl/1.5.3/model/interface-delete.tpl b/deploy/goctl/model/interface-delete.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/interface-delete.tpl rename to deploy/goctl/model/interface-delete.tpl diff --git a/deploy/goctl/1.5.3/model/interface-find-one-by-field.tpl b/deploy/goctl/model/interface-find-one-by-field.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/interface-find-one-by-field.tpl rename to deploy/goctl/model/interface-find-one-by-field.tpl diff --git a/deploy/goctl/1.5.3/model/interface-find-one.tpl b/deploy/goctl/model/interface-find-one.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/interface-find-one.tpl rename to deploy/goctl/model/interface-find-one.tpl diff --git a/deploy/goctl/1.5.3/model/interface-insert.tpl b/deploy/goctl/model/interface-insert.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/interface-insert.tpl rename to deploy/goctl/model/interface-insert.tpl diff --git a/deploy/goctl/1.5.3/model/interface-update.tpl b/deploy/goctl/model/interface-update.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/interface-update.tpl rename to deploy/goctl/model/interface-update.tpl diff --git a/deploy/goctl/1.5.3/model/model-gen.tpl b/deploy/goctl/model/model-gen.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/model-gen.tpl rename to deploy/goctl/model/model-gen.tpl diff --git a/deploy/goctl/model/model-new.tpl b/deploy/goctl/model/model-new.tpl new file mode 100644 index 00000000..f6271cca --- /dev/null +++ b/deploy/goctl/model/model-new.tpl @@ -0,0 +1,7 @@ +func new{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf, opts ...cache.Option{{end}}) *default{{.upperStartCamelObject}}Model { + return &default{{.upperStartCamelObject}}Model{ + {{if .withCache}}CachedConn: sqlc.NewConn(conn, c, opts...){{else}}conn:conn{{end}}, + table: {{.table}}, + } +} + diff --git a/deploy/goctl/1.5.3/model/model.tpl b/deploy/goctl/model/model.tpl similarity index 65% rename from deploy/goctl/1.5.3/model/model.tpl rename to deploy/goctl/model/model.tpl index 2ca914a4..d861da79 100644 --- a/deploy/goctl/1.5.3/model/model.tpl +++ b/deploy/goctl/model/model.tpl @@ -15,6 +15,7 @@ type ( // and implement the added methods in custom{{.upperStartCamelObject}}Model. {{.upperStartCamelObject}}Model interface { {{.lowerStartCamelObject}}Model + {{if not .withCache}}withSession(session sqlx.Session) {{.upperStartCamelObject}}Model{{end}} } custom{{.upperStartCamelObject}}Model struct { @@ -23,8 +24,15 @@ type ( ) // New{{.upperStartCamelObject}}Model returns a model for the database table. -func New{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf{{end}}) {{.upperStartCamelObject}}Model { +func New{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf, opts ...cache.Option{{end}}) {{.upperStartCamelObject}}Model { return &custom{{.upperStartCamelObject}}Model{ - default{{.upperStartCamelObject}}Model: new{{.upperStartCamelObject}}Model(conn{{if .withCache}}, c{{end}}), + default{{.upperStartCamelObject}}Model: new{{.upperStartCamelObject}}Model(conn{{if .withCache}}, c, opts...{{end}}), } } + +{{if not .withCache}} +func (m *custom{{.upperStartCamelObject}}Model) withSession(session sqlx.Session) {{.upperStartCamelObject}}Model { + return New{{.upperStartCamelObject}}Model(sqlx.NewSqlConnFromSession(session)) +} +{{end}} + diff --git a/deploy/goctl/1.5.3/model/table-name.tpl b/deploy/goctl/model/table-name.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/table-name.tpl rename to deploy/goctl/model/table-name.tpl diff --git a/deploy/goctl/1.5.3/model/tag.tpl b/deploy/goctl/model/tag.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/tag.tpl rename to deploy/goctl/model/tag.tpl diff --git a/deploy/goctl/1.5.3/model/types.tpl b/deploy/goctl/model/types.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/types.tpl rename to deploy/goctl/model/types.tpl diff --git a/deploy/goctl/1.5.3/model/update.tpl b/deploy/goctl/model/update.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/update.tpl rename to deploy/goctl/model/update.tpl diff --git a/deploy/goctl/1.5.3/model/var.tpl b/deploy/goctl/model/var.tpl similarity index 100% rename from deploy/goctl/1.5.3/model/var.tpl rename to deploy/goctl/model/var.tpl diff --git a/deploy/goctl/1.5.3/mongo/err.tpl b/deploy/goctl/mongo/err.tpl similarity index 100% rename from deploy/goctl/1.5.3/mongo/err.tpl rename to deploy/goctl/mongo/err.tpl diff --git a/deploy/goctl/1.5.3/mongo/model.tpl b/deploy/goctl/mongo/model.tpl similarity index 100% rename from deploy/goctl/1.5.3/mongo/model.tpl rename to deploy/goctl/mongo/model.tpl diff --git a/deploy/goctl/1.5.3/mongo/model_custom.tpl b/deploy/goctl/mongo/model_custom.tpl similarity index 100% rename from deploy/goctl/1.5.3/mongo/model_custom.tpl rename to deploy/goctl/mongo/model_custom.tpl diff --git a/deploy/goctl/1.5.3/mongo/model_types.tpl b/deploy/goctl/mongo/model_types.tpl similarity index 100% rename from deploy/goctl/1.5.3/mongo/model_types.tpl rename to deploy/goctl/mongo/model_types.tpl diff --git a/deploy/goctl/1.5.3/newapi/newtemplate.tpl b/deploy/goctl/newapi/newtemplate.tpl similarity index 93% rename from deploy/goctl/1.5.3/newapi/newtemplate.tpl rename to deploy/goctl/newapi/newtemplate.tpl index 28be5100..b6773441 100644 --- a/deploy/goctl/1.5.3/newapi/newtemplate.tpl +++ b/deploy/goctl/newapi/newtemplate.tpl @@ -1,3 +1,5 @@ +syntax = "v1" + type Request { Name string `path:"name,options=you|me"` } diff --git a/deploy/goctl/1.5.3/rpc/call.tpl b/deploy/goctl/rpc/call.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/call.tpl rename to deploy/goctl/rpc/call.tpl diff --git a/deploy/goctl/1.5.3/rpc/config.tpl b/deploy/goctl/rpc/config.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/config.tpl rename to deploy/goctl/rpc/config.tpl diff --git a/deploy/goctl/1.5.3/rpc/etc.tpl b/deploy/goctl/rpc/etc.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/etc.tpl rename to deploy/goctl/rpc/etc.tpl diff --git a/deploy/goctl/1.5.3/rpc/logic-func.tpl b/deploy/goctl/rpc/logic-func.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/logic-func.tpl rename to deploy/goctl/rpc/logic-func.tpl diff --git a/deploy/goctl/1.5.3/rpc/logic.tpl b/deploy/goctl/rpc/logic.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/logic.tpl rename to deploy/goctl/rpc/logic.tpl diff --git a/deploy/goctl/1.5.3/rpc/main.tpl b/deploy/goctl/rpc/main.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/main.tpl rename to deploy/goctl/rpc/main.tpl diff --git a/deploy/goctl/1.5.3/rpc/server-func.tpl b/deploy/goctl/rpc/server-func.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/server-func.tpl rename to deploy/goctl/rpc/server-func.tpl diff --git a/deploy/goctl/1.5.3/rpc/server.tpl b/deploy/goctl/rpc/server.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/server.tpl rename to deploy/goctl/rpc/server.tpl diff --git a/deploy/goctl/1.5.3/rpc/svc.tpl b/deploy/goctl/rpc/svc.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/svc.tpl rename to deploy/goctl/rpc/svc.tpl diff --git a/deploy/goctl/1.5.3/rpc/template.tpl b/deploy/goctl/rpc/template.tpl similarity index 100% rename from deploy/goctl/1.5.3/rpc/template.tpl rename to deploy/goctl/rpc/template.tpl diff --git a/rpc/client/participantservice/participantservice.go b/rpc/client/participantservice/participantservice.go index a360559c..bf751af9 100644 --- a/rpc/client/participantservice/participantservice.go +++ b/rpc/client/participantservice/participantservice.go @@ -62,6 +62,8 @@ type ( ListTenant(ctx context.Context, in *TenantInfo, opts ...grpc.CallOption) (*ListTenantResp, error) // applyList 执行任务列表 ApplyList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) + // DeleteList 删除任务列表 + DeleteList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) } defaultParticipantService struct { @@ -128,3 +130,9 @@ func (m *defaultParticipantService) ApplyList(ctx context.Context, in *ApplyList client := pcmCore.NewParticipantServiceClient(m.cli.Conn()) return client.ApplyList(ctx, in, opts...) } + +// DeleteList 删除任务列表 +func (m *defaultParticipantService) DeleteList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) { + client := pcmCore.NewParticipantServiceClient(m.cli.Conn()) + return client.DeleteList(ctx, in, opts...) +} diff --git a/rpc/internal/logic/participantservice/deletelistlogic.go b/rpc/internal/logic/participantservice/deletelistlogic.go new file mode 100644 index 00000000..bf883615 --- /dev/null +++ b/rpc/internal/logic/participantservice/deletelistlogic.go @@ -0,0 +1,36 @@ +package participantservicelogic + +import ( + "context" + + "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/internal/svc" + "gitlink.org.cn/jcce-pcm/pcm-coordinator/rpc/pcmCore" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteListLogic { + return &DeleteListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// DeleteList 删除任务列表 +func (l *DeleteListLogic) DeleteList(in *pcmCore.ApplyListReq) (*pcmCore.ApplyListResp, error) { + result := pcmCore.ApplyListResp{ + InfoList: make([]*pcmCore.ApplyInfo, 0), + } + l.svcCtx.DbEngin.Raw("SELECT sppi.`name` as ParticipantName,c.yaml_string as YamlString FROM cloud c,sc_participant_phy_info sppi where c.`status` = 'WaitDelete' and sppi.id = c.participant_id").Scan(&result.InfoList) + if len(result.InfoList) != 0 { + l.svcCtx.DbEngin.Exec("update cloud set status = ? where status = ?", "Deleted", "WaitDelete") + } + return &result, nil +} diff --git a/rpc/internal/server/participantservice/participantserviceserver.go b/rpc/internal/server/participantservice/participantserviceserver.go index f7bf739f..8f50239e 100644 --- a/rpc/internal/server/participantservice/participantserviceserver.go +++ b/rpc/internal/server/participantservice/participantserviceserver.go @@ -75,3 +75,9 @@ func (s *ParticipantServiceServer) ApplyList(ctx context.Context, in *pcmCore.Ap l := participantservicelogic.NewApplyListLogic(ctx, s.svcCtx) return l.ApplyList(in) } + +// DeleteList 删除任务列表 +func (s *ParticipantServiceServer) DeleteList(ctx context.Context, in *pcmCore.ApplyListReq) (*pcmCore.ApplyListResp, error) { + l := participantservicelogic.NewDeleteListLogic(ctx, s.svcCtx) + return l.DeleteList(in) +} diff --git a/rpc/pb/pcmCore.proto b/rpc/pb/pcmCore.proto index 894c85b5..37842ddf 100644 --- a/rpc/pb/pcmCore.proto +++ b/rpc/pb/pcmCore.proto @@ -326,4 +326,7 @@ service participantService { // applyList 执行任务列表 rpc applyList(ApplyListReq) returns (ApplyListResp) {}; + + // DeleteList 删除任务列表 + rpc deleteList(ApplyListReq) returns (ApplyListResp) {}; } \ No newline at end of file diff --git a/rpc/pcmCore/pcmCore.pb.go b/rpc/pcmCore/pcmCore.pb.go index cf9199c3..676b5b43 100644 --- a/rpc/pcmCore/pcmCore.pb.go +++ b/rpc/pcmCore/pcmCore.pb.go @@ -3045,7 +3045,7 @@ var file_pb_pcmCore_proto_rawDesc = []byte{ 0x08, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x32, 0xba, 0x05, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x74, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x32, 0xf9, 0x05, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x13, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, @@ -3089,8 +3089,12 @@ var file_pb_pcmCore_proto_rawDesc = []byte{ 0x73, 0x74, 0x12, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x15, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, + 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x63, 0x6d, 0x43, 0x6f, + 0x72, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x70, 0x63, 0x6d, 0x43, 0x6f, 0x72, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3168,19 +3172,21 @@ var file_pb_pcmCore_proto_depIdxs = []int32{ 24, // 25: pcmCore.participantService.registerTenant:input_type -> pcmCore.TenantInfo 24, // 26: pcmCore.participantService.listTenant:input_type -> pcmCore.TenantInfo 27, // 27: pcmCore.participantService.applyList:input_type -> pcmCore.ApplyListReq - 6, // 28: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp - 8, // 29: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp - 12, // 30: pcmCore.participantService.registerParticipant:output_type -> pcmCore.ParticipantPhyResp - 11, // 31: pcmCore.participantService.reportHeartbeat:output_type -> pcmCore.HealthCheckResp - 21, // 32: pcmCore.participantService.reportAvailable:output_type -> pcmCore.ParticipantResp - 22, // 33: pcmCore.participantService.listParticipant:output_type -> pcmCore.ParticipantServiceResp - 20, // 34: pcmCore.participantService.listPhyAvailable:output_type -> pcmCore.ListParticipantAvailResp - 13, // 35: pcmCore.participantService.listPhyInformation:output_type -> pcmCore.ListParticipantPhyResp - 25, // 36: pcmCore.participantService.registerTenant:output_type -> pcmCore.TenantResp - 26, // 37: pcmCore.participantService.listTenant:output_type -> pcmCore.ListTenantResp - 28, // 38: pcmCore.participantService.applyList:output_type -> pcmCore.ApplyListResp - 28, // [28:39] is the sub-list for method output_type - 17, // [17:28] is the sub-list for method input_type + 27, // 28: pcmCore.participantService.deleteList:input_type -> pcmCore.ApplyListReq + 6, // 29: pcmCore.pcmCore.SyncInfo:output_type -> pcmCore.SyncInfoResp + 8, // 30: pcmCore.pcmCore.InfoList:output_type -> pcmCore.InfoListResp + 12, // 31: pcmCore.participantService.registerParticipant:output_type -> pcmCore.ParticipantPhyResp + 11, // 32: pcmCore.participantService.reportHeartbeat:output_type -> pcmCore.HealthCheckResp + 21, // 33: pcmCore.participantService.reportAvailable:output_type -> pcmCore.ParticipantResp + 22, // 34: pcmCore.participantService.listParticipant:output_type -> pcmCore.ParticipantServiceResp + 20, // 35: pcmCore.participantService.listPhyAvailable:output_type -> pcmCore.ListParticipantAvailResp + 13, // 36: pcmCore.participantService.listPhyInformation:output_type -> pcmCore.ListParticipantPhyResp + 25, // 37: pcmCore.participantService.registerTenant:output_type -> pcmCore.TenantResp + 26, // 38: pcmCore.participantService.listTenant:output_type -> pcmCore.ListTenantResp + 28, // 39: pcmCore.participantService.applyList:output_type -> pcmCore.ApplyListResp + 28, // 40: pcmCore.participantService.deleteList:output_type -> pcmCore.ApplyListResp + 29, // [29:41] is the sub-list for method output_type + 17, // [17:29] is the sub-list for method input_type 17, // [17:17] is the sub-list for extension type_name 17, // [17:17] is the sub-list for extension extendee 0, // [0:17] is the sub-list for field type_name diff --git a/rpc/pcmCore/pcmCore_grpc.pb.go b/rpc/pcmCore/pcmCore_grpc.pb.go index 7d4aa9b6..117f043a 100644 --- a/rpc/pcmCore/pcmCore_grpc.pb.go +++ b/rpc/pcmCore/pcmCore_grpc.pb.go @@ -159,6 +159,7 @@ const ( ParticipantService_RegisterTenant_FullMethodName = "/pcmCore.participantService/registerTenant" ParticipantService_ListTenant_FullMethodName = "/pcmCore.participantService/listTenant" ParticipantService_ApplyList_FullMethodName = "/pcmCore.participantService/applyList" + ParticipantService_DeleteList_FullMethodName = "/pcmCore.participantService/deleteList" ) // ParticipantServiceClient is the client API for ParticipantService service. @@ -183,6 +184,8 @@ type ParticipantServiceClient interface { ListTenant(ctx context.Context, in *TenantInfo, opts ...grpc.CallOption) (*ListTenantResp, error) // applyList 执行任务列表 ApplyList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) + // DeleteList 删除任务列表 + DeleteList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) } type participantServiceClient struct { @@ -274,6 +277,15 @@ func (c *participantServiceClient) ApplyList(ctx context.Context, in *ApplyListR return out, nil } +func (c *participantServiceClient) DeleteList(ctx context.Context, in *ApplyListReq, opts ...grpc.CallOption) (*ApplyListResp, error) { + out := new(ApplyListResp) + err := c.cc.Invoke(ctx, ParticipantService_DeleteList_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ParticipantServiceServer is the server API for ParticipantService service. // All implementations must embed UnimplementedParticipantServiceServer // for forward compatibility @@ -296,6 +308,8 @@ type ParticipantServiceServer interface { ListTenant(context.Context, *TenantInfo) (*ListTenantResp, error) // applyList 执行任务列表 ApplyList(context.Context, *ApplyListReq) (*ApplyListResp, error) + // DeleteList 删除任务列表 + DeleteList(context.Context, *ApplyListReq) (*ApplyListResp, error) mustEmbedUnimplementedParticipantServiceServer() } @@ -330,6 +344,9 @@ func (UnimplementedParticipantServiceServer) ListTenant(context.Context, *Tenant func (UnimplementedParticipantServiceServer) ApplyList(context.Context, *ApplyListReq) (*ApplyListResp, error) { return nil, status.Errorf(codes.Unimplemented, "method ApplyList not implemented") } +func (UnimplementedParticipantServiceServer) DeleteList(context.Context, *ApplyListReq) (*ApplyListResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteList not implemented") +} func (UnimplementedParticipantServiceServer) mustEmbedUnimplementedParticipantServiceServer() {} // UnsafeParticipantServiceServer may be embedded to opt out of forward compatibility for this service. @@ -505,6 +522,24 @@ func _ParticipantService_ApplyList_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _ParticipantService_DeleteList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ParticipantServiceServer).DeleteList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ParticipantService_DeleteList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ParticipantServiceServer).DeleteList(ctx, req.(*ApplyListReq)) + } + return interceptor(ctx, in, info, handler) +} + // ParticipantService_ServiceDesc is the grpc.ServiceDesc for ParticipantService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -548,6 +583,10 @@ var ParticipantService_ServiceDesc = grpc.ServiceDesc{ MethodName: "applyList", Handler: _ParticipantService_ApplyList_Handler, }, + { + MethodName: "deleteList", + Handler: _ParticipantService_DeleteList_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "pb/pcmCore.proto",