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

Function DBFindWorkspaceForTabId

pkg/wstore/wstore_dbops.go:393–410  ·  view source on GitHub ↗
(ctx context.Context, tabId string)

Source from the content-addressed store, hash-verified

391}
392
393func DBFindWorkspaceForTabId(ctx context.Context, tabId string) (string, error) {
394 return WithTxRtn(ctx, func(tx *TxWrap) (string, error) {
395 query := `
396 WITH variable(value) AS (
397 SELECT ?
398 )
399 SELECT w.oid
400 FROM db_workspace w, variable
401 WHERE EXISTS (
402 SELECT 1
403 FROM json_each(w.data, '$.tabids') AS je
404 WHERE je.value = variable.value
405 );
406 `
407 wsId := tx.GetString(query, tabId)
408 return wsId, nil
409 })
410}
411
412func DBFindWindowForWorkspaceId(ctx context.Context, workspaceId string) (string, error) {
413 return WithTxRtn(ctx, func(tx *TxWrap) (string, error) {

Callers 6

BlockInfoCommandMethod · 0.92
resolveThisFunction · 0.92
resolveTabNumFunction · 0.92
determineScopesFunction · 0.92
makeSwapTokenFunction · 0.92
DeleteBlockFunction · 0.92

Calls 2

GetStringMethod · 0.80
WithTxRtnFunction · 0.70

Tested by

no test coverage detected