MCPcopy Create free account
hub / github.com/dwyl/learn-postgresql / insert_log_item

Function insert_log_item

server/db.js:234–243  ·  view source on GitHub ↗

* insert_log_item does exactly what it's name suggests inserts a log enty * @param {String} url - the current url (page) being viewed. * @param {String} next_page - the next page to be fetched. * @param {function} callback - callback function to be executed on success.

(url, next_page, callback)

Source from the content-addressed store, hash-verified

232 * @param {function} callback - callback function to be executed on success.
233 */
234function insert_log_item (url, next_page, callback) {
235 connect( function () {
236 const query = `INSERT INTO logs (url, next_page) VALUES ($1, $2)`;
237 const values = [url, next_page]
238 PG_CLIENT.query(query, values, function(error, data) {
239 utils.log_error(error, data, new Error().stack);
240 return utils.exec_cb(callback, error, data);
241 });
242 });
243}
244
245function profile_next_page(urls, username) {
246 urls.push(username + '/followers');

Callers 1

insert_next_pageFunction · 0.85

Calls 1

connectFunction · 0.85

Tested by

no test coverage detected