MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / DBGetBlockViewCounts

Function DBGetBlockViewCounts

pkg/wstore/wstore_dbops.go:66–82  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

64var viewRe = regexp.MustCompile(`^[a-z0-9]{1,20}$`)
65
66func DBGetBlockViewCounts(ctx context.Context) (map[string]int, error) {
67 return WithTxRtn(ctx, func(tx *TxWrap) (map[string]int, error) {
68 query := `SELECT COALESCE(json_extract(data, '$.meta.view'), '') AS view FROM db_block`
69 views := tx.SelectStrings(query)
70 rtn := make(map[string]int)
71 for _, view := range views {
72 if view == "" {
73 continue
74 }
75 if !viewRe.MatchString(view) {
76 continue
77 }
78 rtn[view]++
79 }
80 return rtn, nil
81 })
82}
83
84type idDataType struct {
85 OId string

Callers 2

updateTelemetryCountsFunction · 0.92
beforeSendActivityUpdateFunction · 0.92

Calls 1

WithTxRtnFunction · 0.70

Tested by

no test coverage detected