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

Function insert_org

server/db.js:90–103  ·  view source on GitHub ↗

* insert_org saves an org's data to the orgs table. *

(data, callback)

Source from the content-addressed store, hash-verified

88 *
89 */
90function insert_org (data, callback) {
91 connect( function insert_org_after_connected () {
92 const { url,name,description,location,website,email,pcount,uid } = data;
93 const query = `INSERT INTO orgs
94 (url, name, description, location, website, email, pcount, uid)
95 VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`;
96 const values = [url,name,description,location,website,email,pcount,uid];
97
98 PG_CLIENT.query(query, values, function(error, result) {
99 utils.log_error(error, data, new Error().stack);
100 return insert_next_page (data, callback);
101 });
102 });
103}
104
105/**
106 * select_org retrieves the org for a given url.

Callers

nothing calls this directly

Calls 2

connectFunction · 0.85
insert_next_pageFunction · 0.85

Tested by

no test coverage detected