MCPcopy
hub / github.com/wavetermdev/waveterm / DBUpdateFn

Function DBUpdateFn

pkg/wstore/wstore_dbops.go:320–329  ·  view source on GitHub ↗
(ctx context.Context, id string, updateFn func(T))

Source from the content-addressed store, hash-verified

318}
319
320func DBUpdateFn[T waveobj.WaveObj](ctx context.Context, id string, updateFn func(T)) error {
321 return WithTx(ctx, func(tx *TxWrap) error {
322 val, err := DBMustGet[T](tx.Context(), id)
323 if err != nil {
324 return err
325 }
326 updateFn(val)
327 return DBUpdate(tx.Context(), val)
328 })
329}
330
331func DBUpdateFnErr[T waveobj.WaveObj](ctx context.Context, id string, updateFn func(T) error) error {
332 return WithTx(ctx, func(tx *TxWrap) error {

Callers 10

StartJobFunction · 0.92
runOutputLoopFunction · 0.92
HandleCmdJobExitedFunction · 0.92
doTerminateJobManagerFunction · 0.92
doReconnectJobFunction · 0.92
restartStreamingFunction · 0.92
AttachJobToBlockFunction · 0.92
DetachJobFromBlockFunction · 0.92
SendInputFunction · 0.92

Calls 3

DBUpdateFunction · 0.85
WithTxFunction · 0.70
ContextMethod · 0.45

Tested by

no test coverage detected