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

Function DBExistsORef

pkg/wstore/wstore_dbops.go:125–131  ·  view source on GitHub ↗
(ctx context.Context, oref waveobj.ORef)

Source from the content-addressed store, hash-verified

123}
124
125func DBExistsORef(ctx context.Context, oref waveobj.ORef) (bool, error) {
126 return WithTxRtn(ctx, func(tx *TxWrap) (bool, error) {
127 table := tableNameFromOType(oref.OType)
128 query := fmt.Sprintf("SELECT oid FROM %s WHERE oid = ?", table)
129 return tx.Exists(query, oref.OID), nil
130 })
131}
132
133func DBGet[T waveobj.WaveObj](ctx context.Context, id string) (T, error) {
134 rtn, err := DBGetORef(ctx, waveobj.ORef{OType: getOTypeGen[T](), OID: id})

Callers 1

UpdateObjectMethod · 0.92

Calls 2

tableNameFromOTypeFunction · 0.85
WithTxRtnFunction · 0.70

Tested by

no test coverage detected