Example #1
0
File: xorm.go Project: mabetle/mdb
// Id is uuid value.
// model is a pointer.
func (s Xorm) UuidSave(model interface{}) (int64, error) {
	logger.Trace("UuidSave modell")
	if mmodel.GetModelId(model) == "" {
		mmodel.AddModelUuid(model)
	}
	n, err := s.Engine.Insert(model)
	logger.CheckError(err)
	return n, err
}
Example #2
0
func Demo(m1 interface{}) {
	fmt.Println(mmodel.GetModelId(m1))
	m2 := mmodel.AddModelUuid(m1)
	fmt.Printf("%+v\n", m1)
	fmt.Printf("%+v\n", m2)
}