func Save(DB db.IDb, table *db.Table, entity IEntity) error { logger.CallerAt(1).Debugf("DAOUtils.Save: %s", entity) if entity.GetVersion() == nil { entity.SetVersion(Int64(1)) //entity.SetCreation(NOW()) -> PreInsert id, err := DB.Insert(table).Submit(entity) if err != nil { return err } entity.SetId(&id) } else { // TODO should check the deletion column in the where clause //entity.SetModification(NOW()) -> PreUpdate _, err := DB.Update(table).Submit(entity) if err != nil { return err } } return nil }