数据库操作
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

34 lines
666 B

package dbquery
import (
"log"
"testing"
)
func Test_Connet(t *testing.T) {
//go func() {
for i := 0; i < 100; i++ {
dbhost := "106.52.13.101"
dbname := "shop"
dbusername := "yueheng_read"
dbpassword := "yhmast@4&345Ms"
dbport := "13306"
err := Connect(dbhost, dbusername, dbpassword, dbname, dbport)
if err != nil {
log.Println(err.Error())
}
//_,err = new(Query).Db(dbname).Table("ttl_user").Where("id > 0").Select()
_, err = new(Query).Db(dbname).Table("ttl_news").
Datas([]string{"title=?", "content=?"}).
Values([]interface{}{"aaaaaaaaa", "bbbbbb"}).Create()
if err != nil {
log.Println(err.Error())
}
}
//}()
}