You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/06/15 07:56:39 UTC

[incubator-devlake] 12/12: replace hack code

This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 0c273670f7fdff2b9995b84cc0f4b9343642bbc5
Author: linyh <ya...@meri.co>
AuthorDate: Wed Jun 15 15:42:41 2022 +0800

    replace hack code
---
 helpers/e2ehelper/data_flow_tester.go | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/helpers/e2ehelper/data_flow_tester.go b/helpers/e2ehelper/data_flow_tester.go
index 6fb97580..4f30f681 100644
--- a/helpers/e2ehelper/data_flow_tester.go
+++ b/helpers/e2ehelper/data_flow_tester.go
@@ -20,6 +20,7 @@ package e2ehelper
 import (
 	"context"
 	"database/sql"
+	"encoding/json"
 	"fmt"
 	"github.com/apache/incubator-devlake/config"
 	"github.com/apache/incubator-devlake/helpers/pluginhelper"
@@ -105,10 +106,7 @@ func (t *DataFlowTester) ImportCsvIntoRawTable(csvRelPath string, tableName stri
 	// load rows and insert into target table
 	for csvIter.HasNext() {
 		toInsertValues := csvIter.Fetch()
-		// FIXME Hack code
-		if t.Db.Dialector.Name() == `postgres` {
-			toInsertValues[`data`] = strings.Replace(toInsertValues[`data`].(string), `\`, `\\`, -1)
-		}
+		toInsertValues[`data`] = json.RawMessage(toInsertValues[`data`].(string))
 		result := t.Db.Table(tableName).Create(toInsertValues)
 		if result.Error != nil {
 			panic(result.Error)