package main import ( "git.hilo.cn/hilo-common/script/model" "git.hilo.cn/hilo-common/script/mysql" ) func main() { var prodUser []model.UserNoId sql := "SELECT * FROM `user` where id BETWEEN 888888 and 999999 AND avatar <> '' and default_avatar = 0 limit 10000 ;" if err := mysql.ProdReadOnlyDB.Raw(sql).Find(&prodUser).Error; err != nil { panic(err) } for _, user := range prodUser { mysql.TestDB.Create(user) } }