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

Function DBGetAllOIDsByType

pkg/wstore/wstore_dbops.go:206–218  ·  view source on GitHub ↗
(ctx context.Context, otype string)

Source from the content-addressed store, hash-verified

204}
205
206func DBGetAllOIDsByType(ctx context.Context, otype string) ([]string, error) {
207 return WithTxRtn(ctx, func(tx *TxWrap) ([]string, error) {
208 rtn := make([]string, 0)
209 table := tableNameFromOType(otype)
210 query := fmt.Sprintf("SELECT oid FROM %s", table)
211 var rows []idDataType
212 tx.Select(&rows, query)
213 for _, row := range rows {
214 rtn = append(rtn, row.OId)
215 }
216 return rtn, nil
217 })
218}
219
220func DBGetAllObjsByType[T waveobj.WaveObj](ctx context.Context, otype string) ([]T, error) {
221 return WithTxRtn(ctx, func(tx *TxWrap) ([]T, error) {

Callers 1

GetUserInputMethod · 0.92

Calls 2

tableNameFromOTypeFunction · 0.85
WithTxRtnFunction · 0.70

Tested by

no test coverage detected