Skip to content

Commit

Permalink
Fix/Change
Browse files Browse the repository at this point in the history
- 修复db.Data需要手动添加""符号的问题
- 修改Data方法的Null处理,现在输入"nil"和空字符串都会让字段变成Null type,而不是原来的null的string type
  • Loading branch information
tobycroft committed Nov 23, 2023
1 parent 45f8e91 commit ef8e4a4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions builder_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,17 @@ func (b *BuilderOracle) parseData(operType string, data []map[string]interface{}
// 定义1条数据的存储
var dataValuesSub []string
for _, key := range dataFields {
if item[key] == nil {
// 放入占位符
dataValuesSub = append(dataValuesSub, b.GetPlaceholder())
// 保存真正的值为null
b.IOrm.SetBindValues("null")
} else {
// 放入占位符
dataValuesSub = append(dataValuesSub, b.GetPlaceholder())
// 保存真正的值
b.IOrm.SetBindValues(item[key])
}
//if item[key] == nil {
// // 放入占位符
// dataValuesSub = append(dataValuesSub, b.GetPlaceholder())
// // 保存真正的值为null
// b.IOrm.SetBindValues("null")
//} else {
// 放入占位符
dataValuesSub = append(dataValuesSub, b.GetPlaceholder())
// 保存真正的值
b.IOrm.SetBindValues(item[key])
//}
// update
dataObj = append(dataObj, fmt.Sprintf("%s=%s", b.AddFieldQuotesOracle(key), b.GetPlaceholder()))
}
Expand Down

0 comments on commit ef8e4a4

Please sign in to comment.