(ctx context.Context, oref waveobj.ORef, meta waveobj.MetaMapType, mergeSpecial bool)
| 55 | } |
| 56 | |
| 57 | func UpdateObjectMeta(ctx context.Context, oref waveobj.ORef, meta waveobj.MetaMapType, mergeSpecial bool) error { |
| 58 | return WithTx(ctx, func(tx *TxWrap) error { |
| 59 | if oref.IsEmpty() { |
| 60 | return fmt.Errorf("empty object reference") |
| 61 | } |
| 62 | obj, _ := DBGetORef(tx.Context(), oref) |
| 63 | if obj == nil { |
| 64 | return ErrNotFound |
| 65 | } |
| 66 | objMeta := waveobj.GetMeta(obj) |
| 67 | if objMeta == nil { |
| 68 | objMeta = make(map[string]any) |
| 69 | } |
| 70 | newMeta := waveobj.MergeMeta(objMeta, meta, mergeSpecial) |
| 71 | waveobj.SetMeta(obj, newMeta) |
| 72 | DBUpdate(tx.Context(), obj) |
| 73 | return nil |
| 74 | }) |
| 75 | } |
no test coverage detected