MCPcopy
hub / github.com/mayneyao/eidos / findRowIndexInQuery

Method findRowIndexInQuery

packages/core/meta-table/view.ts:150–170  ·  view source on GitHub ↗
(
    table_id: string,
    rowId: string,
    query: string
  )

Source from the content-addressed store, hash-verified

148 }
149
150 public async findRowIndexInQuery(
151 table_id: string,
152 rowId: string,
153 query: string
154 ): Promise<number> {
155 const tableName = `tb_${table_id}`
156 console.log("findRowIndexInQuery", tableName, rowId, query)
157 try {
158 // Check if the row exists in the temporary table
159 const newQuery = replaceWithFindIndexQuery(query, rowId)
160 const result = await this.dataSpace.exec2(newQuery)
161 console.log("result", query, result)
162 return result[0]._index_in_view as number
163 } catch (error) {
164 console.error(error)
165 } finally {
166 // Drop the temporary table
167 // await this.dataSpace.exec2(`DROP TABLE ${tmpTableName}`)
168 }
169 return 1
170 }
171
172 // after entity field changed, the formula field may be changed, so we need to recompute the formula field
173 @timeit(100)

Callers 1

useDataSourceFunction · 0.80

Calls 4

logMethod · 0.65
errorMethod · 0.65
exec2Method · 0.45

Tested by

no test coverage detected