You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/07/01 05:31:50 UTC

[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #2215: [feat-1022][github]: Support GitHub Milestones

keon94 commented on code in PR #2215:
URL: https://github.com/apache/incubator-devlake/pull/2215#discussion_r911626639


##########
helpers/e2ehelper/data_flow_tester.go:
##########
@@ -174,24 +187,51 @@ func (t *DataFlowTester) Subtask(subtaskMeta core.SubTaskMeta, taskData interfac
 }
 
 func (t *DataFlowTester) getPkFields(dst schema.Tabler) []string {
+	return t.getFields(dst, func(column gorm.ColumnType) bool {
+		isPk, _ := column.PrimaryKey()
+		return isPk
+	})
+}
+
+func filterColumn(column gorm.ColumnType, opts TableOptions) bool {
+	for _, ignore := range opts.IgnoreFields {
+		if column.Name() == ignore {
+			return false
+		}
+	}
+	if len(opts.TargetFields) == 0 {
+		return true
+	}
+	targetFound := false
+	for _, target := range opts.TargetFields {
+		if column.Name() == target {
+			targetFound = true
+			break
+		}
+	}
+	return targetFound
+}
+
+func (t *DataFlowTester) getFields(dst schema.Tabler, filter func(column gorm.ColumnType) bool) []string {
 	columnTypes, err := t.Db.Migrator().ColumnTypes(dst)
 	var pkFields []string

Review Comment:
   yep, must've been from copy-paste. good catch



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org