How to use the abstract-leveldown/abstract-iterator.call function in abstract-leveldown

To help you get started, we’ve selected a few abstract-leveldown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ralphtheninja / pgdown / pg-iterator.js View on Github external
function PgIterator (db, options) {
  debug('# new PgIterator (db, options = %j)', options)

  AbstractIterator.call(this, db)

  this._keyAsBuffer = options.keyAsBuffer
  this._valueAsBuffer = options.valueAsBuffer

  const statement = PgIterator._parseOptions(db, options)
  const relation = db._config._relation
  const head = `
    SELECT key::${db._keyColumnType}, value::${db._valueColumnType} FROM ${relation}
  `

  statement.clauses.unshift(head)
  statement.text = statement.clauses.join(' ')

  this._cursor = util.createCursor(db, statement)
}
github calvinmetcalf / SQLdown / iterator.js View on Github external
function Iterator(db, options, cb) {
  AbstractIterator.call(this, db);
  this._db = db.knexDb;
  options = options || {};
  this._order = !options.reverse;
  this._options = options;
  names.forEach(function (i) {
    goodOptions(options, i);
  });
  this._count = 0;
  var self = this;
  if ('limit' in options) {
    this._limit = options.limit;
  } else {
    this._limit = -1;
  }

  if ('keyAsBuffer' in options) {
github ralphtheninja / pgdown / pgiterator.js View on Github external
function PgIterator (db, options) {
  AbstractIterator.call(this, db)

  this._keyAsBuffer = options.keyAsBuffer
  this._valueAsBuffer = options.valueAsBuffer
  this._pool = db._pool

  const params = this._params = []
  const clauses = []
  clauses.push(`SELECT key, value FROM ${db._qname}`)

  const constraints = _constraintSql(options)
  if (constraints) {
    params.push(constraints)
    clauses.push('WHERE $' + params.length)
  }

  clauses.push('ORDER BY key ' + (options.reverse ? 'DESC' : 'ASC'))