Ejemplo n.º 1
0
func (this *Model) End(result bool, args ...*xorm.Session) (err error) {
	var ss *xorm.Session
	if len(args) > 0 && args[0] != nil {
		ss = args[0]
	} else {
		ss, _ = this.transSession()
	}
	if result {
		err = ss.Commit()
	} else {
		err = ss.Rollback()
	}
	if err != nil {
		this.Context.Object().Echo().Logger().Error(err)
	}
	ss.Close()
	this.Context.Set(`webx:transSession`, nil)
	return
}