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

Function DBSelectORefs

pkg/wstore/wstore_dbops.go:188–204  ·  view source on GitHub ↗
(ctx context.Context, orefs []waveobj.ORef)

Source from the content-addressed store, hash-verified

186}
187
188func DBSelectORefs(ctx context.Context, orefs []waveobj.ORef) ([]waveobj.WaveObj, error) {
189 oidsByType := make(map[string][]string)
190 for _, oref := range orefs {
191 oidsByType[oref.OType] = append(oidsByType[oref.OType], oref.OID)
192 }
193 return WithTxRtn(ctx, func(tx *TxWrap) ([]waveobj.WaveObj, error) {
194 rtn := make([]waveobj.WaveObj, 0, len(orefs))
195 for otype, oids := range oidsByType {
196 rtnArr, err := dbSelectOIDs(tx.Context(), otype, oids)
197 if err != nil {
198 return nil, err
199 }
200 rtn = append(rtn, rtnArr...)
201 }
202 return rtn, nil
203 })
204}
205
206func DBGetAllOIDsByType(ctx context.Context, otype string) ([]string, error) {
207 return WithTxRtn(ctx, func(tx *TxWrap) ([]string, error) {

Callers 2

SetActiveTabMethod · 0.92
GetObjectsMethod · 0.92

Calls 3

dbSelectOIDsFunction · 0.85
WithTxRtnFunction · 0.70
ContextMethod · 0.45

Tested by

no test coverage detected