diff --git a/frame/gins/gins_database.go b/frame/gins/gins_database.go index 66d1bb742..d68b10a0c 100644 --- a/frame/gins/gins_database.go +++ b/frame/gins/gins_database.go @@ -16,6 +16,8 @@ import ( "github.com/gogf/gf/v2/internal/consts" "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/text/gregex" + "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gutil" ) @@ -171,5 +173,13 @@ func parseDBConfigNode(value interface{}) *gdb.ConfigNode { if _, v := gutil.MapPossibleItemByKey(nodeMap, "Link"); v != nil { node.Link = gconv.String(v) } + // Parse `Link` configuration syntax. + if node.Link != "" && node.Type == "" { + match, _ := gregex.MatchString(`([a-z]+):(.+)`, node.Link) + if len(match) == 3 { + node.Type = gstr.Trim(match[1]) + node.Link = gstr.Trim(match[2]) + } + } return node }