Open hw2499 opened 5 months ago
Please provide more details on the following information.
Thank you for your reply .
key;value MrLi; {path1:/usr/local/a} MrAa; {path1:/usr/local/b}
queryString := "" + "SET @@IMPORT_FORMAT TO JSON;" + "SET @@FORMAT TO JSON;" + "SET @@PRETTY_PRINT TO TRUE;" + "SET @@DELIMITER TO ';';"
_, err = db.Exec(queryString)
if err != nil {
fmt.Println("runtime fail:", err)
}
stdout := query.NewOutput()
csvq.SetStdout(stdout)
queryString = "select * from `readme2.csv`"
_, err = db.Query(queryString)
if err != nil {
fmt.Println("query fail:", err)
}
fmt.Println("stdout.String():", stdout.String())
stdout.String(): [
{
"key": "MrLi",
"value": " {path1:\/usr\/local\/a}"
},
{
"key": "MrAa",
"value": " {path1:\/usr\/local\/b}"
}
]
[ { "key": "MrLi", "value": " {path1:/usr/local/a}" }, { "key": "MrAa", "value": " {path1:/usr/local/b}" } ]
Thank you, I understand what you want.
According to RFC8259, solidus (U+002F) is not MUST be escaped, but it is listed as a character to be escaped, so csvq is also escapes it in the output. It can be read with or without escaping when reading, but currently there is no option to exclude escaping of this character in the output.
Thank you for your reply. I hope to have time to implement this feature in the future
The JSON content includes BackSLASH The following code Stdout:=query NewOutput() Csvq SetStdout (stdout) Fmt Println ("stdout. String():", stdout String() It was found that the output of stdout escaped/opt/, resulting in \/opt \/, This is not the desired effect, what if it is set to incorrect/escaped?