diff --git a/.example/other/test.go b/.example/other/test.go index f72598ed7..0a03ce678 100644 --- a/.example/other/test.go +++ b/.example/other/test.go @@ -1,14 +1,16 @@ package main import ( - "fmt" - "github.com/gogf/gf/os/gfile" - "github.com/gogf/gf/text/gregex" + "github.com/gogf/gf/frame/g" ) func main() { - fmt.Println(gfile.Basename("/tmp/1585227151172826000/access.20200326205231173924.log")) - fmt.Println( - gregex.IsMatchString(`.+\.\d{20}\.log`, - gfile.Basename("/tmp/1585227151172826000/access.20200326205231173924.log"))) + g.DB().SetDebug(true) + tx, err := g.DB().Begin() + if err != nil { + panic(err) + } + smsTaskInfo := "`sms_sys`.sms_task_info" + m := tx.Table(smsTaskInfo) + _, err = m.Where("`delete`=0 AND is_review_temp=1 AND UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(create_time)>=86400").Delete() } diff --git a/.travis.yml b/.travis.yml index 5ef9c9afa..b9e38f278 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: go go: - - "1.11.x" - - "1.12.x" - "1.13.x" - "1.14.x" diff --git a/README.MD b/README.MD index 9a4aacc50..653dacc00 100644 --- a/README.MD +++ b/README.MD @@ -28,7 +28,7 @@ require github.com/gogf/gf latest # Limitation ``` -golang version >= 1.11 +golang version >= 1.13 ``` # Documentation diff --git a/README_ZH.MD b/README_ZH.MD index cec8c3b2e..07c36a7f1 100644 --- a/README_ZH.MD +++ b/README_ZH.MD @@ -41,7 +41,7 @@ require github.com/gogf/gf latest # 限制 ```shell -golang版本 >= 1.11 +golang版本 >= 1.13 ``` # 架构 diff --git a/database/gdb/gdb_func.go b/database/gdb/gdb_func.go index ea0e39dd1..b00fefd95 100644 --- a/database/gdb/gdb_func.go +++ b/database/gdb/gdb_func.go @@ -103,21 +103,27 @@ func DataToMapDeep(obj interface{}) map[string]interface{} { return data } -// QuotePrefixTableName adds prefix string and quote chars for the table. It handles table string like: -// "user", "user u", "user,user_detail", "user u, user_detail ut", "user as u, user_detail as ut", "user.user u". +// doHandleTableName adds prefix string and quote chars for the table. It handles table string like: +// "user", "user u", "user,user_detail", "user u, user_detail ut", "user as u, user_detail as ut", +// "user.user u", "`user`.`user` u". // // Note that, this will automatically checks the table prefix whether already added, if true it does // nothing to the table name, or else adds the prefix to the table name. func doHandleTableName(table, prefix, charLeft, charRight string) string { - index := 0 - array1 := gstr.SplitAndTrim(table, ",") + var ( + index = 0 + chars = charLeft + charRight + array1 = gstr.SplitAndTrim(table, ",") + ) for k1, v1 := range array1 { array2 := gstr.SplitAndTrim(v1, " ") // Trim the security chars. - array2[0] = gstr.TrimLeftStr(array2[0], charLeft) - array2[0] = gstr.TrimRightStr(array2[0], charRight) + array2[0] = gstr.Trim(array2[0], chars) // Check whether it has database name. array3 := gstr.Split(gstr.Trim(array2[0]), ".") + for k, v := range array3 { + array3[k] = gstr.Trim(v, chars) + } index = len(array3) - 1 // If the table name already has the prefix, skips the prefix adding. if len(array3[index]) <= len(prefix) || array3[index][:len(prefix)] != prefix { diff --git a/database/gdb/gdb_unit_z_func_test.go b/database/gdb/gdb_unit_z_func_test.go index fa6453fe5..3e6941c97 100644 --- a/database/gdb/gdb_unit_z_func_test.go +++ b/database/gdb/gdb_unit_z_func_test.go @@ -84,6 +84,8 @@ func Test_Func_addTablePrefix(t *testing.T) { "user as u": "`user` as u", "user,user_detail": "`user`,`user_detail`", "user u, user_detail ut": "`user` u,`user_detail` ut", + "`user`.user_detail": "`user`.`user_detail`", + "`user`.`user_detail`": "`user`.`user_detail`", "user as u, user_detail as ut": "`user` as u,`user_detail` as ut", "UserCenter.user as u, UserCenter.user_detail as ut": "`UserCenter`.`user` as u,`UserCenter`.`user_detail` as ut", // mssql global schema access with double dots. @@ -101,6 +103,8 @@ func Test_Func_addTablePrefix(t *testing.T) { "user as u": "`gf_user` as u", "user,user_detail": "`gf_user`,`gf_user_detail`", "user u, user_detail ut": "`gf_user` u,`gf_user_detail` ut", + "`user`.user_detail": "`user`.`gf_user_detail`", + "`user`.`user_detail`": "`user`.`gf_user_detail`", "user as u, user_detail as ut": "`gf_user` as u,`gf_user_detail` as ut", "UserCenter.user as u, UserCenter.user_detail as ut": "`UserCenter`.`gf_user` as u,`UserCenter`.`gf_user_detail` as ut", // mssql global schema access with double dots. diff --git a/go.mod b/go.mod index d82b1ab16..b643eba10 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/gogf/gf -go 1.11 +go 1.13 require ( github.com/BurntSushi/toml v0.3.1 diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index c2632ee67..d81da7d60 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -35,11 +35,11 @@ type Logger struct { } const ( - gDEFAULT_FILE_FORMAT = `{Y-m-d}.log` - gDEFAULT_FILE_FLAGS = os.O_CREATE | os.O_WRONLY | os.O_APPEND - gDEFAULT_FILE_PERM = os.FileMode(0666) - gDEFAULT_FILE_EXPIRE = time.Minute - gPATH_FILTER_KEY = "/os/glog/glog" + gDEFAULT_FILE_FORMAT l.con = `{Y-m-d}.log` + gDEFAULT_FILE_FLAGS = os.O_CREATE | os.O_WRONLY | os.O_APPEND + gDEFAULT_FILE_PERM = os.FileMode(0666) + gDEFAULT_FILE_EXPIRE = time.Minute + gPATH_FILTER_KEY = "/os/glog/glog" ) const ( @@ -58,7 +58,7 @@ func New() *Logger { config: DefaultConfig(), } // Initialize the internal handler after some delay. - gtimer.AddOnce(500*time.Millisecond, func() { + gtimer.AddOnce(time.Second, func() { gtimer.AddOnce(logger.config.RotateCheckInterval, logger.rotateChecksTimely) }) return logger