提交 23a51b39 authored 作者: mooncake's avatar mooncake

update

上级 73eac9db
...@@ -14,7 +14,7 @@ const ( ...@@ -14,7 +14,7 @@ const (
Tag2 = "query" Tag2 = "query"
) )
func Scopes(where any) func(db *gorm.DB) *gorm.DB { func MakeScopes(where any) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB { return func(db *gorm.DB) *gorm.DB {
return makeScopes(db, where) return makeScopes(db, where)
} }
......
...@@ -24,7 +24,7 @@ func TestMakeWhere(t *testing.T) { ...@@ -24,7 +24,7 @@ func TestMakeWhere(t *testing.T) {
in.IDs = []xsf.ID{10, 2, 3} in.IDs = []xsf.ID{10, 2, 3}
in.UserID = 10 in.UserID = 10
in.SiteName = "优盟" in.SiteName = "优盟"
scopes := gormutils.Scopes(in) scopes := gormutils.MakeScopes(in)
conn := getConn() conn := getConn()
var rs []*User var rs []*User
if e := conn.WithContext(context.TODO()). if e := conn.WithContext(context.TODO()).
...@@ -53,7 +53,6 @@ func getConn() *gorm.DB { ...@@ -53,7 +53,6 @@ func getConn() *gorm.DB {
}, },
) )
dsn := "root:123456@tcp(localhost:30006)/qitu_operator?charset=utf8mb4&parseTime=True&loc=Local" dsn := "root:123456@tcp(localhost:30006)/qitu_operator?charset=utf8mb4&parseTime=True&loc=Local"
// 方法2:全局DryRun配置
con, _ := gorm.Open(mysql.Open(dsn), &gorm.Config{Logger: newLogger}) con, _ := gorm.Open(mysql.Open(dsn), &gorm.Config{Logger: newLogger})
return con return con
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论