(uiContext waveobj.UIContext, waveObj waveobj.WaveObj, returnUpdates bool)
| 140 | } |
| 141 | |
| 142 | func (svc *ObjectService) UpdateObject(uiContext waveobj.UIContext, waveObj waveobj.WaveObj, returnUpdates bool) (waveobj.UpdatesRtnType, error) { |
| 143 | ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout) |
| 144 | defer cancelFn() |
| 145 | ctx = waveobj.ContextWithUpdates(ctx) |
| 146 | if waveObj == nil { |
| 147 | return nil, fmt.Errorf("update wavobj is nil") |
| 148 | } |
| 149 | oref := waveobj.ORefFromWaveObj(waveObj) |
| 150 | found, err := wstore.DBExistsORef(ctx, *oref) |
| 151 | if err != nil { |
| 152 | return nil, fmt.Errorf("error getting object: %w", err) |
| 153 | } |
| 154 | if !found { |
| 155 | return nil, fmt.Errorf("object not found: %s", oref) |
| 156 | } |
| 157 | err = wstore.DBUpdate(ctx, waveObj) |
| 158 | if err != nil { |
| 159 | return nil, fmt.Errorf("error updating object: %w", err) |
| 160 | } |
| 161 | if (waveObj.GetOType() == waveobj.OType_Workspace) && (waveObj.(*waveobj.Workspace).Name != "") { |
| 162 | wps.Broker.Publish(wps.WaveEvent{ |
| 163 | Event: wps.Event_WorkspaceUpdate}) |
| 164 | } |
| 165 | if returnUpdates { |
| 166 | return waveobj.ContextGetUpdatesRtn(ctx), nil |
| 167 | } |
| 168 | return nil, nil |
| 169 | } |
nothing calls this directly
no test coverage detected