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
如果是同时插入多条数据,有对应的api吗,比如 insertMulit 这种
The text was updated successfully, but these errors were encountered:
方法1: dbx 100%支持原生,所以可以使用原生的方法来批量执行
rawInsertBaseSQL = "INSERT INTO `model` (`name`, `title`, `fax`, `web`, `age`, `right`, `counter`) VALUES " rawInsertValuesSQL = "(?, ?, ?, ?, ?, ?, ?)" rawInsertSQL = rawInsertBaseSQL + rawInsertValuesSQL query := rawInsertBaseSQL + strings.Repeat(rawInsertValuesSQL+",", len(ms)-1) + rawInsertValuesSQL args := make([]interface{}, len(ms)*nFields) for j := range ms { offset := j * nFields args[offset+0] = ms[j].Name args[offset+1] = ms[j].Title args[offset+2] = ms[j].Fax args[offset+3] = ms[j].Web args[offset+4] = ms[j].Age args[offset+5] = ms[j].Right args[offset+6] = ms[j].Counter } _, _, err := database.Execute(query, args...) if err != nil { fmt.Println(err) b.FailNow() }
Sorry, something went wrong.
No branches or pull requests
如果是同时插入多条数据,有对应的api吗,比如 insertMulit 这种
The text was updated successfully, but these errors were encountered: