UNPKG

@ocap/statedb-qldb

Version:

OCAP statedb adapter that uses amazon qldb as backend statedb

22 lines (16 loc) 480 B
const QLDBTable = require('./base'); class TokenTable extends QLDBTable { constructor(...args) { super(...args); this.indexes.push('symbol'); } async existBySymbol(symbol, { txn }) { if (!symbol) { return false; } const result = await txn.execute(`SELECT address FROM ${this.name} WHERE "symbol" = ?`, symbol); const item = result.getResultList(); return JSON.parse(JSON.stringify(item)).length > 0; } } module.exports = TokenTable;