Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Rename FindXXXById to ComposeXXById, AddXXXRelationship to ComposeXXXRelationship
天舟da6efe2ad1d8
diff --git a/backend/server/database.go b/backend/server/database.goindex 6f7b59635f..666ba13fdc 100644--- a/backend/server/database.go+++ b/backend/server/database.go@@ -30,7 +30,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create database").SetInternal(err)}- if err := s.AddDatabaseRelationship(context.Background(), database, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeDatabaseRelationship(context.Background(), database, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -59,7 +59,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {}for _, database := range list {- if err := s.AddDatabaseRelationship(context.Background(), database, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeDatabaseRelationship(context.Background(), database, c.Get(getIncludeKey()).([]string)); err != nil {return err}}@@ -77,7 +77,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)}- database, err := s.FindDatabaseById(context.Background(), id, c.Get(getIncludeKey()).([]string))+ database, err := s.ComposeDatabaseById(context.Background(), id, c.Get(getIncludeKey()).([]string))if err != nil {return err}@@ -112,7 +112,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch database ID: %v", id)).SetInternal(err)}- if err := s.AddDatabaseRelationship(context.Background(), database, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeDatabaseRelationship(context.Background(), database, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -124,7 +124,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})}-func (s *Server) FindDatabaseById(ctx context.Context, id int, includeList []string) (*api.Database, error) {+func (s *Server) ComposeDatabaseById(ctx context.Context, id int, includeList []string) (*api.Database, error) {databaseFind := &api.DatabaseFind{ID: &id,}@@ -136,17 +136,17 @@ func (s *Server) FindDatabaseById(ctx context.Context, id int, includeList []strreturn nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch database ID: %v", id)).SetInternal(err)}- if err := s.AddDatabaseRelationship(ctx, database, includeList); err != nil {+ if err := s.ComposeDatabaseRelationship(ctx, database, includeList); err != nil {return nil, err}return database, nil}-func (s *Server) AddDatabaseRelationship(ctx context.Context, database *api.Database, includeList []string) error {+func (s *Server) ComposeDatabaseRelationship(ctx context.Context, database *api.Database, includeList []string) error {var err errorif sort.SearchStrings(includeList, "project") >= 0 {- database.Project, err = s.FindProjectById(context.Background(), database.ProjectId, includeList)+ database.Project, err = s.ComposeProjectlById(context.Background(), database.ProjectId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project for database: %v", database.Name)).SetInternal(err)}diff --git a/backend/server/instance.go b/backend/server/instance.goindex 4f3f4bcfae..8bbca2bf16 100644--- a/backend/server/instance.go+++ b/backend/server/instance.go@@ -30,7 +30,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create instance").SetInternal(err)}- if err := s.AddInstanceRelationship(context.Background(), instance, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeInstanceRelationship(context.Background(), instance, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -52,7 +52,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {}for _, instance := range list {- if err := s.AddInstanceRelationship(context.Background(), instance, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeInstanceRelationship(context.Background(), instance, c.Get(getIncludeKey()).([]string)); err != nil {return err}}@@ -70,7 +70,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)}- instance, err := s.FindInstanceById(context.Background(), id, c.Get(getIncludeKey()).([]string))+ instance, err := s.ComposeInstanceById(context.Background(), id, c.Get(getIncludeKey()).([]string))if err != nil {return err}@@ -141,7 +141,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {}}- if err := s.AddInstanceRelationship(context.Background(), instance, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeInstanceRelationship(context.Background(), instance, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -153,7 +153,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})}-func (s *Server) FindInstanceById(ctx context.Context, id int, incluedList []string) (*api.Instance, error) {+func (s *Server) ComposeInstanceById(ctx context.Context, id int, incluedList []string) (*api.Instance, error) {instanceFind := &api.InstanceFind{ID: &id,}@@ -165,14 +165,14 @@ func (s *Server) FindInstanceById(ctx context.Context, id int, incluedList []strreturn nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch instance ID: %v", id)).SetInternal(err)}- if err := s.AddInstanceRelationship(ctx, instance, incluedList); err != nil {+ if err := s.ComposeInstanceRelationship(ctx, instance, incluedList); err != nil {return nil, err}return instance, nil}-func (s *Server) AddInstanceRelationship(ctx context.Context, instance *api.Instance, includeList []string) error {+func (s *Server) ComposeInstanceRelationship(ctx context.Context, instance *api.Instance, includeList []string) error {var err errorif sort.SearchStrings(includeList, "environment") >= 0 {environmentFind := &api.EnvironmentFind{diff --git a/backend/server/issue.go b/backend/server/issue.goindex 77ffcec909..8ead260759 100644--- a/backend/server/issue.go+++ b/backend/server/issue.go@@ -30,7 +30,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create issue").SetInternal(err)}- if err := s.AddIssueRelationship(context.Background(), issue, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeIssueRelationship(context.Background(), issue, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -52,7 +52,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {}for _, issue := range list {- if err := s.AddIssueRelationship(context.Background(), issue, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeIssueRelationship(context.Background(), issue, c.Get(getIncludeKey()).([]string)); err != nil {return err}}@@ -70,7 +70,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)}- issue, err := s.FindIssueById(context.Background(), id, c.Get(getIncludeKey()).([]string))+ issue, err := s.ComposeIssueById(context.Background(), id, c.Get(getIncludeKey()).([]string))if err != nil {return err}@@ -105,7 +105,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch issue ID: %v", id)).SetInternal(err)}- if err := s.AddIssueRelationship(context.Background(), issue, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeIssueRelationship(context.Background(), issue, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -117,7 +117,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {})}-func (s *Server) FindIssueById(ctx context.Context, id int, incluedList []string) (*api.Issue, error) {+func (s *Server) ComposeIssueById(ctx context.Context, id int, incluedList []string) (*api.Issue, error) {issueFind := &api.IssueFind{ID: &id,}@@ -129,41 +129,41 @@ func (s *Server) FindIssueById(ctx context.Context, id int, incluedList []stringreturn nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch issue ID: %v", id)).SetInternal(err)}- if err := s.AddIssueRelationship(ctx, issue, incluedList); err != nil {+ if err := s.ComposeIssueRelationship(ctx, issue, incluedList); err != nil {return nil, err}return issue, nil}-func (s *Server) AddIssueRelationship(ctx context.Context, issue *api.Issue, includeList []string) error {+func (s *Server) ComposeIssueRelationship(ctx context.Context, issue *api.Issue, includeList []string) error {var err errorif sort.SearchStrings(includeList, "principal") >= 0 {- issue.Creator, err = s.FindPrincipalById(context.Background(), issue.CreatorId, includeList)+ issue.Creator, err = s.ComposePrincipalById(context.Background(), issue.CreatorId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch creator for issue: %v", issue.Name)).SetInternal(err)}- issue.Updater, err = s.FindPrincipalById(context.Background(), issue.UpdaterId, includeList)+ issue.Updater, err = s.ComposePrincipalById(context.Background(), issue.UpdaterId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch updater for issue: %v", issue.Name)).SetInternal(err)}- issue.Assignee, err = s.FindPrincipalById(context.Background(), issue.AssigneeId, includeList)+ issue.Assignee, err = s.ComposePrincipalById(context.Background(), issue.AssigneeId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch assignee for issue: %v", issue.Name)).SetInternal(err)}}if sort.SearchStrings(includeList, "project") >= 0 {- issue.Project, err = s.FindProjectById(context.Background(), issue.ProjectId, includeList)+ issue.Project, err = s.ComposeProjectlById(context.Background(), issue.ProjectId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project for issue: %v", issue.Name)).SetInternal(err)}}if sort.SearchStrings(includeList, "pipeline") >= 0 {- issue.Pipeline, err = s.FindPipelineById(context.Background(), issue.PipelineId, includeList)+ issue.Pipeline, err = s.ComposePipelineById(context.Background(), issue.PipelineId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch pipeline for issue: %v", issue.Name)).SetInternal(err)}diff --git a/backend/server/pipeline.go b/backend/server/pipeline.goindex b3812fbfed..f5a59cc09f 100644--- a/backend/server/pipeline.go+++ b/backend/server/pipeline.go@@ -10,7 +10,7 @@ import ("github.com/labstack/echo/v4")-func (s *Server) FindPipelineById(ctx context.Context, id int, incluedList []string) (*api.Pipeline, error) {+func (s *Server) ComposePipelineById(ctx context.Context, id int, incluedList []string) (*api.Pipeline, error) {pipelineFind := &api.PipelineFind{ID: &id,}@@ -22,27 +22,27 @@ func (s *Server) FindPipelineById(ctx context.Context, id int, incluedList []strreturn nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch pipeline ID: %v", id)).SetInternal(err)}- if err := s.AddPipelineRelationship(ctx, pipeline, incluedList); err != nil {+ if err := s.ComposePipelineRelationship(ctx, pipeline, incluedList); err != nil {return nil, err}return pipeline, nil}-func (s *Server) AddPipelineRelationship(ctx context.Context, pipeline *api.Pipeline, includeList []string) error {+func (s *Server) ComposePipelineRelationship(ctx context.Context, pipeline *api.Pipeline, includeList []string) error {var err error- pipeline.Creator, err = s.FindPrincipalById(context.Background(), pipeline.CreatorId, includeList)+ pipeline.Creator, err = s.ComposePrincipalById(context.Background(), pipeline.CreatorId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch creator for pipeline: %v", pipeline.Name)).SetInternal(err)}- pipeline.Updater, err = s.FindPrincipalById(context.Background(), pipeline.UpdaterId, includeList)+ pipeline.Updater, err = s.ComposePrincipalById(context.Background(), pipeline.UpdaterId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch updater for pipeline: %v", pipeline.Name)).SetInternal(err)}- pipeline.StageList, err = s.FindStageListByPipelineId(context.Background(), pipeline.ID, includeList)+ pipeline.StageList, err = s.ComposeStageListByPipelineId(context.Background(), pipeline.ID, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch stage list for pipeline: %v", pipeline.Name)).SetInternal(err)}diff --git a/backend/server/principal.go b/backend/server/principal.goindex 76194697fc..18adfeefb3 100644--- a/backend/server/principal.go+++ b/backend/server/principal.go@@ -58,7 +58,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)}- principal, err := s.FindPrincipalById(context.Background(), id, c.Get(getIncludeKey()).([]string))+ principal, err := s.ComposePrincipalById(context.Background(), id, c.Get(getIncludeKey()).([]string))if err != nil {return err}@@ -99,7 +99,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {})}-func (s *Server) FindPrincipalById(ctx context.Context, id int, incluedList []string) (*api.Principal, error) {+func (s *Server) ComposePrincipalById(ctx context.Context, id int, incluedList []string) (*api.Principal, error) {principalFind := &api.PrincipalFind{ID: &id,}diff --git a/backend/server/project.go b/backend/server/project.goindex ec90e63816..268078296c 100644--- a/backend/server/project.go+++ b/backend/server/project.go@@ -28,7 +28,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create project").SetInternal(err)}- if err := s.AddProjectRelationship(context.Background(), project, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeProjectRelationship(context.Background(), project, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -50,7 +50,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {}for _, project := range list {- if err := s.AddProjectRelationship(context.Background(), project, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeProjectRelationship(context.Background(), project, c.Get(getIncludeKey()).([]string)); err != nil {return err}}@@ -68,7 +68,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)}- project, err := s.FindProjectById(context.Background(), id, c.Get(getIncludeKey()).([]string))+ project, err := s.ComposeProjectlById(context.Background(), id, c.Get(getIncludeKey()).([]string))if err != nil {return err}@@ -103,7 +103,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to patch project ID: %v", id)).SetInternal(err)}- if err := s.AddProjectRelationship(context.Background(), project, c.Get(getIncludeKey()).([]string)); err != nil {+ if err := s.ComposeProjectRelationship(context.Background(), project, c.Get(getIncludeKey()).([]string)); err != nil {return err}@@ -115,7 +115,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})}-func (s *Server) FindProjectById(ctx context.Context, id int, includeList []string) (*api.Project, error) {+func (s *Server) ComposeProjectlById(ctx context.Context, id int, includeList []string) (*api.Project, error) {projectFind := &api.ProjectFind{ID: &id,}@@ -127,14 +127,14 @@ func (s *Server) FindProjectById(ctx context.Context, id int, includeList []strireturn nil, echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", id)).SetInternal(err)}- if err := s.AddProjectRelationship(ctx, project, includeList); err != nil {+ if err := s.ComposeProjectRelationship(ctx, project, includeList); err != nil {return nil, err}return project, nil}-func (s *Server) AddProjectRelationship(ctx context.Context, project *api.Project, includeList []string) error {+func (s *Server) ComposeProjectRelationship(ctx context.Context, project *api.Project, includeList []string) error {var err errorif sort.SearchStrings(includeList, "projectMember") >= 0 {projectMemberFind := &api.ProjectMemberFind{diff --git a/backend/server/stage.go b/backend/server/stage.goindex 406b15b97a..4ac05e5e93 100644--- a/backend/server/stage.go+++ b/backend/server/stage.go@@ -9,7 +9,7 @@ import ("github.com/labstack/echo/v4")-func (s *Server) FindStageListByPipelineId(ctx context.Context, pipelineId int, incluedList []string) ([]*api.Stage, error) {+func (s *Server) ComposeStageListByPipelineId(ctx context.Context, pipelineId int, incluedList []string) ([]*api.Stage, error) {stageFind := &api.StageFind{PipelineId: &pipelineId,}@@ -19,7 +19,7 @@ func (s *Server) FindStageListByPipelineId(ctx context.Context, pipelineId int,}for _, stage := range stageList {- if err := s.AddStageRelationship(ctx, stage, incluedList); err != nil {+ if err := s.ComposeStageRelationship(ctx, stage, incluedList); err != nil {return nil, err}}@@ -27,14 +27,14 @@ func (s *Server) FindStageListByPipelineId(ctx context.Context, pipelineId int,return stageList, nil}-func (s *Server) AddStageRelationship(ctx context.Context, stage *api.Stage, includeList []string) error {+func (s *Server) ComposeStageRelationship(ctx context.Context, stage *api.Stage, includeList []string) error {var err error- stage.Creator, err = s.FindPrincipalById(context.Background(), stage.CreatorId, includeList)+ stage.Creator, err = s.ComposePrincipalById(context.Background(), stage.CreatorId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch creator for stage: %v", stage.Name)).SetInternal(err)}- stage.Updater, err = s.FindPrincipalById(context.Background(), stage.UpdaterId, includeList)+ stage.Updater, err = s.ComposePrincipalById(context.Background(), stage.UpdaterId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch updater for stage: %v", stage.Name)).SetInternal(err)}@@ -47,7 +47,7 @@ func (s *Server) AddStageRelationship(ctx context.Context, stage *api.Stage, increturn echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch environment for stage: %v", stage.Name)).SetInternal(err)}- stage.TaskList, err = s.FindTaskListByStageId(context.Background(), stage.ID, includeList)+ stage.TaskList, err = s.ComposeTaskListByStageId(context.Background(), stage.ID, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch task list for stage: %v", stage.Name)).SetInternal(err)}diff --git a/backend/server/task.go b/backend/server/task.goindex ced3c5d8f4..edbf576205 100644--- a/backend/server/task.go+++ b/backend/server/task.go@@ -9,7 +9,7 @@ import ("github.com/labstack/echo/v4")-func (s *Server) FindTaskListByStageId(ctx context.Context, stageId int, incluedList []string) ([]*api.Task, error) {+func (s *Server) ComposeTaskListByStageId(ctx context.Context, stageId int, incluedList []string) ([]*api.Task, error) {taskFind := &api.TaskFind{StageId: &stageId,}@@ -19,7 +19,7 @@ func (s *Server) FindTaskListByStageId(ctx context.Context, stageId int, inclued}for _, task := range taskList {- if err := s.AddTaskRelationship(ctx, task, incluedList); err != nil {+ if err := s.ComposeTaskRelationship(ctx, task, incluedList); err != nil {return nil, err}}@@ -27,20 +27,20 @@ func (s *Server) FindTaskListByStageId(ctx context.Context, stageId int, incluedreturn taskList, nil}-func (s *Server) AddTaskRelationship(ctx context.Context, task *api.Task, includeList []string) error {+func (s *Server) ComposeTaskRelationship(ctx context.Context, task *api.Task, includeList []string) error {var err error- task.Creator, err = s.FindPrincipalById(context.Background(), task.CreatorId, includeList)+ task.Creator, err = s.ComposePrincipalById(context.Background(), task.CreatorId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch creator for task: %v", task.Name)).SetInternal(err)}- task.Updater, err = s.FindPrincipalById(context.Background(), task.UpdaterId, includeList)+ task.Updater, err = s.ComposePrincipalById(context.Background(), task.UpdaterId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch updater for task: %v", task.Name)).SetInternal(err)}- task.Database, err = s.FindDatabaseById(context.Background(), task.DatabaseId, includeList)+ task.Database, err = s.ComposeDatabaseById(context.Background(), task.DatabaseId, includeList)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch database for task: %v", task.Name)).SetInternal(err)}