We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GOVERSION="go1.19.13", GOARCH="amd64"
go env
GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/root/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/root/go" GOPRIVATE="" ... GOVERSION="go1.19.13" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1"
I want to read data from csv file and insert it into mysql, mysql table struct is:
CREATE TABLE `test` ( `"name'"` varchar(32) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
1. my csv file:
""name'"" "NULL" """name'"""
2. my code demo:
r := csv.NewReader(os.Stdin) r.LazyQuotes = true lst, err := r.Read() logger.Warningf(context.Background(), "lst: %+v", lst)
the lst result is : ["name'" "NULL]
My code prints the result: ["name'" "NULL]
My expected result should be: ["name'"] So, is this a BUG or is there some wrongs in my code? What should I do to get the expected result?
The text was updated successfully, but these errors were encountered:
that doesn't look like a valid quoting of values for csv
Sorry, something went wrong.
Can you explain why this is not a valid CSV value?
read from csv.NewReader should be?
"name'" NULL ""name'""
LazyQuotes = true, so quotes in fields don't have to be doubled: It's parsed as:
"
name'
""
NULL
No branches or pull requests
Go version
GOVERSION="go1.19.13", GOARCH="amd64"
Output of
go env
in your module/workspace:What did you do?
I want to read data from csv file and insert it into mysql, mysql table struct is:
1. my csv file:
2. my code demo:
the lst result is :
["name'"
"NULL]
What did you see happen?
My code prints the result:
["name'"
"NULL]
What did you expect to see?
My expected result should be: ["name'"]
So, is this a BUG or is there some wrongs in my code?
What should I do to get the expected result?
The text was updated successfully, but these errors were encountered: