Exemple #1
0
//UPDATE `tb_user` SET `image_url`="image" WHERE `uid`=1
func ExampleUpdateQuery2() {
	esql := easysql.Update("tb_user").Column("image_url", "image").Where("uid=?", 1)
	query, args, err := esql.Query()
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	fmt.Println(query)
	fmt.Println(args)

	// output:
	// UPDATE `tb_user` SET `image_url`=? WHERE (`uid`=?)
	// [image 1]
}
Exemple #2
0
//UPDATE tb_account SET name="iron", password="******" where id=1;
func ExampleUpdateQuery1() {
	esql := easysql.Update("tb_account").Columns("name, password", "iron", "123456").Where("id=?", 1)
	query, args, err := esql.Query()
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	fmt.Println(query)
	fmt.Println(args)

	// output:
	// UPDATE `tb_account` SET `name`=?, `password`=? WHERE (`id`=?)
	// [iron 123456 1]
}