Created
May 6, 2019 18:37
-
-
Save robherley/a18f10dc0b4bf977c6f812bf5d341bf2 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
const SQL = require('sql-template-strings'); | |
module.exports = { | |
slice: (start, end) => SQL` | |
SELECT | |
eventid, | |
CAST(latitude AS REAL) AS latitude, | |
CAST(longitude AS REAL) AS longitude, | |
CAST(nkill AS INT) AS nkill, | |
CAST(iyear AS INT) AS year | |
FROM | |
attacks | |
WHERE | |
iyear >= ${+start} AND iyear <= ${+end} | |
`, | |
infoById: id => SQL` | |
SELECT * FROM attacks WHERE eventid = ${id} | |
` | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment