package mysql import ( "log" "testing" ) func TestMysqlSelect(t *testing.T) { m := &Mysql{ Address: "192.168.3.217:4000", UserName: "root", PassWord: "=PDT49#80Z!RVv52_z", DBName: "jianyu", MaxOpenConns: 2, //用于设置最大打开的连接数,默认值为0表示不限制。 MaxIdleConns: 2, //用于设置闲置的连接数。 } m.Init() list := m.SelectBySql(`select * from entniche_info limit ?`, 1) log.Println("-----", list) } // func TestClickHouseSelect(t *testing.T) { m := NewInit("clickhouse", "clickhouse://jytop:pwdTopJy123@192.168.3.207:19000/information?dial_timeout=2000ms&max_execution_time=60s", 1, 1) m.SelectByBath(1, func(l *[]map[string]interface{}) bool { log.Println(l) return true }, `select * from information where createtime>=1708673243 and createtime<1708673245`) //}, `select id from information limit ?`, 1) return list := m.SelectBySql(`select id from information limit ?`, 1) c := m.CountBySql(`select count(1) as c from information`) log.Println("-----", list, c) log.Println(m.InsertBatch("wcj.test", []string{"name"}, []interface{}{"456"})) }