-
Notifications
You must be signed in to change notification settings - Fork 755
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo nits, otherwise lgtm
statement_args.go
Outdated
return true | ||
} | ||
|
||
func covertArg(arg interface{}) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func covertArg(arg interface{}) string { | |
func convertArg(arg interface{}) string { |
statement_args.go
Outdated
@@ -50,7 +93,7 @@ func (statement *Statement) writeArg(w *builder.BytesWriter, arg interface{}) er | |||
return err | |||
} | |||
default: | |||
if _, err := w.WriteString(fmt.Sprintf("%v", argv)); err != nil { | |||
if _, err := w.WriteString(covertArg(arg)); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if _, err := w.WriteString(covertArg(arg)); err != nil { | |
if _, err := w.WriteString(convertArg(arg)); err != nil { |
return false | ||
case reflect.String: | ||
return true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it safer to panic if no match is found? It's possible that some future type of field will be implemented and someone forgets to add it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For an unknown type, it will be converted to a string via fmt.Sprintf("%v", arg)
and replace single quote to two single quotes. Currently all go's basic types have been supported. I think that's enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve, then! 😁
Codecov Report
@@ Coverage Diff @@
## master #1436 +/- ##
==========================================
- Coverage 57.01% 56.93% -0.09%
==========================================
Files 48 48
Lines 8106 8137 +31
==========================================
+ Hits 4622 4633 +11
- Misses 2866 2888 +22
+ Partials 618 616 -2
Continue to review full report at Codecov.
|
fix test fix nil pointer fix statement.Limit(0) will update or delete all data fix bug when buffersize with iterate (go-xorm#941) Merge branch 'master' into lunny/fix_buffer_iterate Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 fix test fix bug fix bug when buffersize with iterate SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Co-authored-by: Guillermo Prandi <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/941 fix update map with version (go-xorm#1448) fix test fix update map with version SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448 Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Improve ci tests (#1477) Rewrite Engine.QuoteTo() to accept multi-part identifiers (#1476) Support local sql log (go-xorm#1338) Fix go mod and update version (go-xorm#1460) Move github.com/go-xorm/xorm to xorm.io/xorm (go-xorm#1459) add support custom type Nullfloat64 (go-xorm#1450) fix bug when query map condtion with no quote (go-xorm#1449) Don't warn when bool column default is 1 but not true (go-xorm#1447) * don't warn when bool column default is 1 but not true * fix default case sensitive Fix sync2 with custom table name (go-xorm#1445) * fix sync2 with custom table name * fix bug on postgres * fix bug on postgres fix bug when update with setexpr (go-xorm#1446) add tidb tests on drone ci (go-xorm#1444) improve sync2 (go-xorm#1443) Fix wrong dbmetas (go-xorm#1442) * add tests for db metas * add more tests * fix bug on mssql Fix default value parse bugs (go-xorm#1437) * fix default value * fix default value tags * fix postgres default * fix default on postgres * fix default on postgres * fix mssql default fix arg conversion (go-xorm#1441) * fix arg conversion * fix bugs * fix bug on postgres * use traditional positional parameters on insert into select * remove unnecessary tests upgrade core (go-xorm#1440) add tests (go-xorm#1439) add go1.13 tests on drone (go-xorm#1416) Fix bug on insert where (go-xorm#1436) * fix bug on insert where * fix bug * fix lint fix bug when insert multiple slices with customize table name (go-xorm#1433) * fix bug when insert multiple slices with customize table name * fix tests on mssql * fix tests fix insert where with bool bug on mssql (go-xorm#1432) fix setexpr missing big quotes (go-xorm#1431) * fix setexpr missing big quotes * fix tests * fix tests Add support subquery on SetExpr (go-xorm#1428) * add support subquery on SetExpr * fix tests fix go mod (go-xorm#1427) fix tests (go-xorm#1429) Use strings.Builder instead of builder.StringBuilder (go-xorm#1417) * use strings.Builder instead of builder.StringBuilder * fix dependency * fix dependency Remove unuse get cols code (go-xorm#1413) Add mssql ci test (go-xorm#1410) * add mssql ci test * fix drone test Add insert select where support (go-xorm#1401) Use drone new format (go-xorm#1388) * use drone new format fix get customize type bug (go-xorm#1382) fix bugs (go-xorm#1375) update drone (go-xorm#1374) Add tests for get var (go-xorm#1305) * add test for SQL get * fix tests fix error when get null var (go-xorm#890) * fix error when get null var * add support get for null var * fix bug Remove quotestr totally (go-xorm#1366) * remove QuoteStr() totally * update xorm.core -> v0.7.0 * update dialect Quote remove QuoteStr() usage in dialects (go-xorm#1364) document of FindAndCount() (go-xorm#1365) remove QuoteStr() usage (go-xorm#1360) Co-authored-by: yifhao <[email protected]> Co-authored-by: yifhao <[email protected]> Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Guillermo Prandi <guillep2k@[email protected]> Co-authored-by: yudppp <[email protected]> Co-authored-by: BetaCat <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1119
Merge branch 'master' into jcsalem/fix/nil_ptr_is_nullable fix bug when buffersize with iterate (go-xorm#941) Merge branch 'master' into lunny/fix_buffer_iterate Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 fix test fix bug fix bug when buffersize with iterate SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Co-authored-by: Guillermo Prandi <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/941 fix update map with version (go-xorm#1448) fix test fix update map with version SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448 Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 For nullable columns, store nil values as NULL fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Improve ci tests (#1477) Rewrite Engine.QuoteTo() to accept multi-part identifiers (#1476) Support local sql log (go-xorm#1338) Fix go mod and update version (go-xorm#1460) Move github.com/go-xorm/xorm to xorm.io/xorm (go-xorm#1459) add support custom type Nullfloat64 (go-xorm#1450) fix bug when query map condtion with no quote (go-xorm#1449) Don't warn when bool column default is 1 but not true (go-xorm#1447) * don't warn when bool column default is 1 but not true * fix default case sensitive Fix sync2 with custom table name (go-xorm#1445) * fix sync2 with custom table name * fix bug on postgres * fix bug on postgres fix bug when update with setexpr (go-xorm#1446) add tidb tests on drone ci (go-xorm#1444) improve sync2 (go-xorm#1443) Fix wrong dbmetas (go-xorm#1442) * add tests for db metas * add more tests * fix bug on mssql Fix default value parse bugs (go-xorm#1437) * fix default value * fix default value tags * fix postgres default * fix default on postgres * fix default on postgres * fix mssql default fix arg conversion (go-xorm#1441) * fix arg conversion * fix bugs * fix bug on postgres * use traditional positional parameters on insert into select * remove unnecessary tests upgrade core (go-xorm#1440) add tests (go-xorm#1439) add go1.13 tests on drone (go-xorm#1416) Fix bug on insert where (go-xorm#1436) * fix bug on insert where * fix bug * fix lint fix bug when insert multiple slices with customize table name (go-xorm#1433) * fix bug when insert multiple slices with customize table name * fix tests on mssql * fix tests fix insert where with bool bug on mssql (go-xorm#1432) fix setexpr missing big quotes (go-xorm#1431) * fix setexpr missing big quotes * fix tests * fix tests Add support subquery on SetExpr (go-xorm#1428) * add support subquery on SetExpr * fix tests fix go mod (go-xorm#1427) fix tests (go-xorm#1429) Use strings.Builder instead of builder.StringBuilder (go-xorm#1417) * use strings.Builder instead of builder.StringBuilder * fix dependency * fix dependency Remove unuse get cols code (go-xorm#1413) Add mssql ci test (go-xorm#1410) * add mssql ci test * fix drone test Add insert select where support (go-xorm#1401) Use drone new format (go-xorm#1388) * use drone new format fix get customize type bug (go-xorm#1382) fix bugs (go-xorm#1375) update drone (go-xorm#1374) Add tests for get var (go-xorm#1305) * add test for SQL get * fix tests fix error when get null var (go-xorm#890) * fix error when get null var * add support get for null var * fix bug Remove quotestr totally (go-xorm#1366) * remove QuoteStr() totally * update xorm.core -> v0.7.0 * update dialect Quote remove QuoteStr() usage in dialects (go-xorm#1364) document of FindAndCount() (go-xorm#1365) remove QuoteStr() usage (go-xorm#1360) make sure timeout in context timeout t... Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Jim Salem <[email protected]> Co-authored-by: Guillermo Prandi <guillep2k@[email protected]> Co-authored-by: yudppp <[email protected]> Co-authored-by: BetaCat <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/531
fix time test add test for time format sign codes according to contributing rules. format time when sqlTypeName is core.Varchar. Same with core.DateTime or core.TimeStamp Add test for second insert error (#1527) Add test for second insert error Reviewed-on: https://gitea.com/xorm/xorm/pulls/1527 Add tests for table name (#1517) add tests for table name Fix test (#1526) Fix test Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526 Fix test (#1526) Fix test Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526 Fix wrong warning log on autoincrement column when sync table (#1525) improve doc Fix wrong warning log on autoincrement column when sync table Reviewed-on: https://gitea.com/xorm/xorm/pulls/1525 Fixed Join strings on func Exist (#1520) fix test fixed Join strings on func Exist Co-authored-by: Tomofumi Kusana <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1520 For nullable columns, store nil values as NULL (go-xorm#531) Merge branch 'master' into jcsalem/fix/nil_ptr_is_nullable fix bug when buffersize with iterate (go-xorm#941) Merge branch 'master' into lunny/fix_buffer_iterate Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 fix test fix bug fix bug when buffersize with iterate SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Co-authored-by: Guillermo Prandi <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/941 fix update map with version (go-xorm#1448) fix test fix update map with version SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448 Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 For nullable columns, store nil values as NULL fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Improve ci tests (#1477) Rewrite Engine.QuoteTo() to accept multi-part identifiers (#1476) Support local sql log (go-xorm#1338) Fix go mod and update version (go-xorm#1460) Move github.com/go-xorm/xorm to xorm.io/xorm (go-xorm#1459) add support custom type Nullfloat64 (go-xorm#1450) fix bug when query map condtion with no quote (go-xorm#1449) Don't warn when bool column default is 1 but not true (go-xorm#1447) * don't warn when bool column default is 1 but not true * fix default case sensitive Fix sync2 with custom table name (go-xorm#1445) * fix sync2 with custom table name * fix bug on postgres * fix bug on postgres fix bug when update with setexpr (go-xorm#1446) add tidb tests on drone ci (go-xorm#1444) improve sync2 (go-xorm#1443) Fix wrong dbmetas (go-xorm#1442) * add tests for db metas * add more tests * fix bug on mssql Fix default value parse bugs (go-xorm#1437) * fix default value * fix default value tags * fix postgres default * fix default on postgres * fix default on postgres * fix mssql default fix arg conversion (go-xorm#1441) * fix arg conversion * fix bugs * fix bug on postgres * use traditional positional parameters on insert into select * remove unnecessary tests upgrade core (go-xorm#1440) add tests (go-xorm#1439) add go1.13 tests on drone (go-xorm#1416) Fix bug on insert where (go-xorm#1436) * fix bug on insert where * fix bug * fix lint fix bug when insert multiple slices with customize table name (go-xorm#1433) * fix bug when insert multiple slices with customize table name * fix tests on mssql * fix tests fix insert where with bool bug on mssql (go-xorm#1432) fix setexpr missing big quotes (go-xorm#1431) * fix setexpr missing big quotes * fix tests * fix tests Add support subquery on SetExpr (go-xorm#1428) * add support subquery on SetExpr * fix tests fix go mod (go-xorm#1427) ... Co-authored-by: DarthPestilane <[email protected]> Co-authored-by: kusana <[email protected]> Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Guillermo Prandi <guillep2k@[email protected]> Co-authored-by: yudppp <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1026
Fix test Fix subquery with schema Add test for join subquery Add makefile (#1531) Fix drone Fix ci Add deps Improve drone Fix envs Add makefile Reviewed-on: https://gitea.com/xorm/xorm/pulls/1531 Add password for postgres drone image (#1530) Add password for postgres drone image Reviewed-on: https://gitea.com/xorm/xorm/pulls/1530 format time when sqlTypeName is core.Varchar (go-xorm#1026) fix time test add test for time format sign codes according to contributing rules. format time when sqlTypeName is core.Varchar. Same with core.DateTime or core.TimeStamp Add test for second insert error (#1527) Add test for second insert error Reviewed-on: https://gitea.com/xorm/xorm/pulls/1527 Add tests for table name (#1517) add tests for table name Fix test (#1526) Fix test Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526 Fix test (#1526) Fix test Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526 Fix wrong warning log on autoincrement column when sync table (#1525) improve doc Fix wrong warning log on autoincrement column when sync table Reviewed-on: https://gitea.com/xorm/xorm/pulls/1525 Fixed Join strings on func Exist (#1520) fix test fixed Join strings on func Exist Co-authored-by: Tomofumi Kusana <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1520 For nullable columns, store nil values as NULL (go-xorm#531) Merge branch 'master' into jcsalem/fix/nil_ptr_is_nullable fix bug when buffersize with iterate (go-xorm#941) Merge branch 'master' into lunny/fix_buffer_iterate Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 fix test fix bug fix bug when buffersize with iterate SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Co-authored-by: Guillermo Prandi <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/941 fix update map with version (go-xorm#1448) fix test fix update map with version SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448 Exclude schema from index name (#1505) Merge branch 'master' into fix-schema-idx SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 fix vet fix drone lint remove go1.10 test on drone Exclude schema from the index name Co-authored-by: Guillermo Prandi <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505 SetExpr support more go types (#1499) Improve tests SetExpr support more go types fix vet fix drone lint remove go1.10 test on drone Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499 For nullable columns, store nil values as NULL fix vet fix drone lint remove go1.10 test on drone Fix update with Alias (go-xorm#1455) Improve ci tests (#1477) Rewrite Engine.QuoteTo() to accept multi-part identifiers (#1476) Support local sql log (go-xorm#1338) Fix go mod and update version (go-xorm#1460) Move github.com/go-xorm/xorm to xorm.io/xorm (go-xorm#1459) add support custom type Nullfloat64 (go-xorm#1450) fix bug when query map condtion with no quote (go-xorm#1449) Don't warn when bool column default is 1 but not true (go-xorm#1447) * don't warn when bool column default is 1 but not true * fix default case sensitive Fix sync2 with custom table name (go-xorm#1445) * fix sync2 with custom table name * fix bug on postgres * fix bug on postgres fix bug when update with setexpr (go-xorm#1446) add tidb tests on drone ci (go-xorm#1444) improve sync2 (go-xorm#1443) Fix wrong dbmetas (go-xorm#1442) * add tests for db metas * add more tests * fix bug on mssql Fix default value parse bugs (go-xorm#1437) * fix default value * fix default value tags * fix postgres default * fix default on postgres * fix default on postgres * fix mssql default fix arg conversion (go-xorm#1441) * fix arg conversion * fix bugs * fix bug on postgres * use traditional positional parameters on insert into select * remove unnecessary tests upgrade core (go-xorm#1440) add tests (go-xorm#1439) add go1.13 tests on drone (go-xorm#1416) Fix bug on insert where (go-xorm#1436) * fix bug on insert where * fix bug * fix lint fix bug when insert multiple... Reviewed-on: https://gitea.com/xorm/xorm/pulls/1528
No description provided.