コード例 #1
0
ファイル: customer.go プロジェクト: polexe/remotedb
func (cm CtMapper) UpdateCustomer(c dto.Customer) (ct orm.Customer) {
	ct = orm.RevertCustomer(c)
	db, _ := getCon()
	t := db.Save(&ct)
	fmt.Println(t)
	return
}
コード例 #2
0
ファイル: customer.go プロジェクト: polexe/remotedb
//creates a customer
func (cm CtMapper) CreateCustomer(c dto.Customer) (created bool) {
	//new orm for customer
	ct := orm.RevertCustomer(c)
	db, _ := getCon()
	res := db.Create(&ct)
	fmt.Printf("%+v\n", res)
	//if not probably because it didn't had a unique id
	created = res.RowsAffected > 0
	return
}