Exemple #1
0
func (cm CtMapper) UpdateCustomer(c dto.Customer) (ct orm.Customer) {
	ct = orm.RevertCustomer(c)
	db, _ := getCon()
	t := db.Save(&ct)
	fmt.Println(t)
	return
}
Exemple #2
0
//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
}