Created
January 9, 2013 19:02
-
-
Save dogeared/4495867 to your computer and use it in GitHub Desktop.
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
"SELECT * FROM meetings WHERE meetingID = '1';" | |
"SELECT * FROM meetingAddress WHERE meetingID = '1';" | |
"SELECT * FROM districts WHERE districtID = '1';" |
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
[ | |
{ | |
name: 'The Kensington Meeting', | |
timeZone: '', | |
districtID: 0, | |
url: 'http://', | |
meetingID: 1, | |
meetingType: '', | |
languageCode: '', | |
meetingAddress: { | |
countryCode: 'CA', | |
urbanization: '', | |
longitude: '', | |
phoneLabel: null, | |
name: '', | |
postcode: 'M5T 1J5', | |
password: '', | |
districtID: 0, | |
url: '', | |
locationNote: 'Currently held on 3rd/top floor -mPlease use the side door to enter and exit', | |
meetingID: 1, | |
city: 'Toronto', | |
state: 'ON', | |
phone: '', | |
username: '', | |
street1: '10 St. Andrew Street', | |
latitude: '', | |
street2: '' | |
}, | |
description: '', | |
district: { | |
phoneLabel: null, | |
districtID: 1, | |
url: '', | |
phone: '', | |
districtNumber: 0, | |
email: '', | |
districtName: 'Independent' | |
} | |
} | |
] |
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
global.inspect = require('eyes').inspector({maxLength: 10000000}) | |
var FastLegSBase = require('FastLegS') | |
global.FastLegS = new FastLegSBase('mysql') | |
FastLegS.connect({host: 'localhost', port: 3306, database: 'd', user: 'u', password: 'p'}) | |
var MeetingAddress = FastLegS.Base.extend({ | |
tableName: 'meetingAddress', | |
primaryKey: 'meetingID' | |
}) | |
var District = FastLegS.Base.extend({ | |
tableName: 'districts', | |
primaryKey: 'districtID', | |
}) | |
var Meeting = FastLegS.Base.extend({ | |
tableName: 'meetings', | |
primaryKey: 'meetingID', | |
one: [ | |
{ district: District, joinOn: 'meetingID' }, | |
{ meetingAddress: MeetingAddress, joinOn: 'meetingID' } | |
] | |
}) | |
Meeting.find( | |
1, | |
{ include: { meetingAddress: {}, district: {} } }, | |
function(err, results) { | |
inspect(results) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment