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

Function DBMustGet

pkg/wstore/wstore_dbops.go:138–149  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

136}
137
138func DBMustGet[T waveobj.WaveObj](ctx context.Context, id string) (T, error) {
139 rtn, err := DBGetORef(ctx, waveobj.ORef{OType: getOTypeGen[T](), OID: id})
140 if err != nil {
141 var zeroVal T
142 return zeroVal, err
143 }
144 if rtn == nil {
145 var zeroVal T
146 return zeroVal, ErrNotFound
147 }
148 return rtn.(T), nil
149}
150
151func DBGetORef(ctx context.Context, oref waveobj.ORef) (waveobj.WaveObj, error) {
152 return WithTxRtn(ctx, func(tx *TxWrap) (waveobj.WaveObj, error) {

Callers 15

MakePlotDataFunction · 0.92
SavePlotDataFunction · 0.92
termCtxWithLogBlockIdFunction · 0.92
BlockInfoCommandMethod · 0.92
BlocksListCommandMethod · 0.92
resolveTabNumFunction · 0.92
resolveViewFunction · 0.92
SaveTerminalStateMethod · 0.92
SetWindowPosAndSizeMethod · 0.92
SetActiveTabMethod · 0.92

Calls 1

DBGetORefFunction · 0.85

Tested by

no test coverage detected