Created
August 25, 2017 02:25
-
-
Save kissmygritts/640085effc5063e010f4ba00abec73d7 to your computer and use it in GitHub Desktop.
ColumnSet help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const sql = require('../sql').elements | |
const helpers = require('pg-promise')().helpers | |
const cs = new helpers.ColumnSet([ | |
'?id', | |
{ | |
name: 'animal_id' | |
}, { | |
name: 'species_id' | |
}, { | |
name: 'sex', | |
def: 'unk' | |
} | |
], {table: { table: 'elements' }}) | |
class Elements { | |
constructor (db, pgp) { | |
this.db = db | |
this.pgp = pgp | |
this.cs = cs || pgp.helpers.ColumnSet([ | |
'?id', | |
{ | |
name: 'animal_id' | |
}, { | |
name: 'species_id' | |
}, { | |
name: 'sex', | |
def: 'unk' | |
} | |
], {table: { table: 'elements' }}) | |
} | |
all () { | |
return this.db.many(sql.all) | |
} | |
} | |
module.exports = Elements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.