Skip to content

Commit

Permalink
feat: rm trim empty
Browse files Browse the repository at this point in the history
  • Loading branch information
qqxhb committed Oct 18, 2024
1 parent 37e64f6 commit 7244e2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions do_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gen

import (
"fmt"
"reflect"
"strings"
"testing"
Expand Down Expand Up @@ -74,6 +75,16 @@ func build(stmt *gorm.Statement, opts ...stmtOpt) *gorm.Statement {
}

func TestDO_methods(t *testing.T) {
s := "' '"
for (len(s) >= 3 && s[0] == '\'' && s[len(s)-1] == '\'' && s[len(s)-2] != '\\') ||
(len(s) == 2 && s == "''") {
fmt.Println("xxx")
s = s[1 : len(s)-1]
}
fmt.Println("aa", s, "bb")

return

testcases := []struct {
Expr SubQuery
Opts []stmtOpt
Expand Down
2 changes: 1 addition & 1 deletion internal/model/tbl_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *Column) needDefaultTag(defaultTagValue string) bool {
case reflect.String:
return defaultTagValue != ""
case reflect.Struct:
return strings.Trim(defaultTagValue, "'0:- ") != ""
return strings.Trim(defaultTagValue, "'0:-") != ""
}
return c.Name() != "created_at" && c.Name() != "updated_at"
}
Expand Down

0 comments on commit 7244e2e

Please sign in to comment.