|
|
|
@ -103,15 +103,15 @@ func Test_Chain(t *testing.T) { |
|
|
|
t.Log(err) |
|
|
|
} |
|
|
|
db_name := "" |
|
|
|
table_name := "ttl_user_log" |
|
|
|
table_name := "ttl_product" |
|
|
|
//time := time.Now().Unix()
|
|
|
|
|
|
|
|
//================查询表结构===========
|
|
|
|
ret, err := new(Query).Db(db_name).GetTableInfo(table_name) |
|
|
|
/*ret, err := new(Query).Db(db_name).GetTableInfo(table_name) |
|
|
|
if err != nil { |
|
|
|
t.Log(err) |
|
|
|
} |
|
|
|
fmt.Println("===GetTableInfo:", ret) |
|
|
|
fmt.Println("===GetTableInfo:", ret)*/ |
|
|
|
|
|
|
|
//==========获取信息=================
|
|
|
|
/*query := new(Query).Db(db_name).Clean().Table("ttl_dorm_goods_reserve").Alias("a"). |
|
|
|
@ -130,12 +130,26 @@ func Test_Chain(t *testing.T) { |
|
|
|
fmt.Println("===Find:", info)*/ |
|
|
|
|
|
|
|
//============获取列表==================
|
|
|
|
list, err := new(Query).Db("").Table("ttl_area"). |
|
|
|
/*list, err := new(Query).Db("").Table("ttl_area"). |
|
|
|
Title("`first`,id,level,mergename,name,pid,shortname"). |
|
|
|
Select() |
|
|
|
if err != nil { |
|
|
|
t.Log(err) |
|
|
|
}*/ |
|
|
|
|
|
|
|
list, err := new(Query).Db(db_name).Table(table_name).Alias("p"). |
|
|
|
//Join([]string{config.T_product_type + " as pt", "p.uuid=pt.product_uuid", "LEFT"}).
|
|
|
|
//Where("pt.type=?").Value("score").
|
|
|
|
//Where("p.is_score_goods=?").Value("1").
|
|
|
|
Where("p.id=?").Value(1). |
|
|
|
Orderby("p.view_count desc"). |
|
|
|
Page(1).PageSize(10). |
|
|
|
Title("p.id,p.view_count,p.title,p.thumb,p.price,p.exchange_score_spend,p.exchange_score_value"). |
|
|
|
Select() |
|
|
|
if err != nil { |
|
|
|
t.Log(err) |
|
|
|
} |
|
|
|
|
|
|
|
fmt.Println("===List:", list) |
|
|
|
|
|
|
|
//===========添加数据============
|
|
|
|
@ -253,3 +267,15 @@ func Test_Chain(t *testing.T) { |
|
|
|
} |
|
|
|
fmt.Println("====================执行事务结束==================")*/ |
|
|
|
} |
|
|
|
|
|
|
|
/*func Test_Data(t *testing.T) { |
|
|
|
aa := 0.50 |
|
|
|
bb := 15.5 |
|
|
|
|
|
|
|
res := ToString(aa) |
|
|
|
resb := ToString(bb) |
|
|
|
|
|
|
|
fmt.Println(res) |
|
|
|
fmt.Println(resb) |
|
|
|
fmt.Println(fmt.Sprintf("%v", aa)) |
|
|
|
}*/ |