/** * @param {!{cols: number, rows: number}} size */ _sendResize(size) { if (this._backend) this._backend.resize(size.cols, size.rows); }
/** * @name PreparedStatement#rows * @type {number} * @description * Number of rows to return at a time from a Prepared Statement's portal. * The default is 0, which means that all rows must be returned at once. */ get rows() { return this._inner.options.rows; }
async query(query, values) { const conn = await this.getConnectionFromPool(); try { const res = await conn.execute(query, values || {}); return res && res.rows; } catch (e) { throw (e); } }
/** @param {Array<*>} array */ add(array) { if (array.length !== this.array.length) throw new Error(`There is too many elements in given data array. Please provide data in this format: ${this.array}`); const tempObj = {}; let arrayCounter = 0; this.array.forEach((elem) => { tempObj[elem] = array[arrayCounter]; tempObj.toString = () => JSON.stringify(tempObj); arrayCounter++; }); this.rows.push({ skip: false, data: tempObj }); }
function onsuspended(x) { new Promise(r => r(backend.query.cursor( backend.query.cursor.rows === 1 ? x[0] : x ))).then(x => { x === END ? socket.write(frontend.Close()) : socket.write(frontend.Execute(backend.query.cursor.rows)) }).catch(err => { socket.write(frontend.Close()) backend.query.reject(err) }) }
constructor(gherkinDataTable) { this.rawData = gherkinDataTable.rows.map((row) => { return row.cells.map((cell) => { return cell.value; }); }); }
async _restartService() { if (this._backend) this._backend.dispose(); const env = await Ndb.nodeProcessManager.env(); this._anotherTerminalHint(env); this._backend = await Ndb.backend.createService( 'terminal.js', rpc.handle(this), env, this._terminal.cols, this._terminal.rows); }
/* make sligthly rotated, scaled and mirrored variants of the input image */ /* can be useful to increase the training set in order to get better results */ /* but also training time increases with numJitters */ function makeGetJitteredFaces(fr) { return function(face, numJitters) { if (numJitters && (face.rows !== face.cols)) { throw new Error('jittering requires the face to have the same number of rows and cols') } return [face].concat(!numJitters ? [] : fr.jitterImage(face, numJitters)) } }
/** * Returns the size of the screen. * * @returns {number[]} The size of the screen as an array of [width, height]. */ function getScreenSize() { return [process.stdout.columns, process.stdout.rows]; }
// validate the data they gave us function validate(rows) { // its supposed to be an array of objects if (Array.isArray(rows)) return rows // a check for the most common error. a lot of ORMs return an object with the desired data on the `rows` property if (rows && rows.rows) return rows.rows throw new Error( `"dbCall" function must return/resolve an array of objects where each object is a row from the result set. Instead got ${util.inspect(rows, { depth: 3 })}` ) }
function getById (db, id) { return db.query('SELECT * FROM jobs WHERE id = $1', [id]) .then(function (res) { var jobs = res.rows return jobs.length > 0 ? jobs[0] : null }) }
/** @param {Array<*>} array */ xadd(array) { if (array.length !== this.array.length) throw new Error(`There is too many elements in given data array. Please provide data in this format: ${this.array}`); const tempObj = {}; let arrayCounter = 0; this.array.forEach((elem) => { tempObj[elem] = array[arrayCounter]; tempObj.toString = () => JSON.stringify(tempObj); arrayCounter++; }); this.rows.push({ skip: true, data: tempObj }); }
/** * Returns the size of the screen. * * @returns {number[]} The size of the screen as an array of [width, height]. */ function getScreenSize() { return [process.stdout.columns, process.stdout.rows]; }