{"action":"created","issue":{"url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings/issues/8","repository_url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings","labels_url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings/issues/8/comments","events_url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings/issues/8/events","html_url":"https://github.com/felixfbecker/node-sql-template-strings/issues/8","id":162852422,"number":8,"title":"append function avoid null will be better.","user":{"login":"taojoe","id":545656,"avatar_url":"https://avatars.githubusercontent.com/u/545656?v=3","gravatar_id":"","url":"https://api.github.com/users/taojoe","html_url":"https://github.com/taojoe","followers_url":"https://api.github.com/users/taojoe/followers","following_url":"https://api.github.com/users/taojoe/following{/other_user}","gists_url":"https://api.github.com/users/taojoe/gists{/gist_id}","starred_url":"https://api.github.com/users/taojoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taojoe/subscriptions","organizations_url":"https://api.github.com/users/taojoe/orgs","repos_url":"https://api.github.com/users/taojoe/repos","events_url":"https://api.github.com/users/taojoe/events{/privacy}","received_events_url":"https://api.github.com/users/taojoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-29T06:45:29Z","updated_at":"2016-06-29T08:04:04Z","closed_at":null,"body":"hi Felix,\r\n\r\nthe new append function, accept string type, if check the parameter is better. when i pass undefined as parameter. the sql will be 'xxundefined'.\r\n\r\nso please check the parameter before line 29, skip null/undefined will be good.\r\n\r\nline 29 ,\r\n  this.strings[this.strings.length - 1] += statement"},"comment":{"url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings/issues/comments/229285332","html_url":"https://github.com/felixfbecker/node-sql-template-strings/issues/8#issuecomment-229285332","issue_url":"https://api.github.com/repos/felixfbecker/node-sql-template-strings/issues/8","id":229285332,"user":{"login":"taojoe","id":545656,"avatar_url":"https://avatars.githubusercontent.com/u/545656?v=3","gravatar_id":"","url":"https://api.github.com/users/taojoe","html_url":"https://github.com/taojoe","followers_url":"https://api.github.com/users/taojoe/followers","following_url":"https://api.github.com/users/taojoe/following{/other_user}","gists_url":"https://api.github.com/users/taojoe/gists{/gist_id}","starred_url":"https://api.github.com/users/taojoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taojoe/subscriptions","organizations_url":"https://api.github.com/users/taojoe/orgs","repos_url":"https://api.github.com/users/taojoe/repos","events_url":"https://api.github.com/users/taojoe/events{/privacy}","received_events_url":"https://api.github.com/users/taojoe/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T08:04:04Z","updated_at":"2016-06-29T08:04:04Z","body":"I extend this library with a 'merge' function, which takes more than one parameter, merge SQL into 1 SQL. The 'merge' function comes with version 1.x, when you upgrade to 2.x, I want to use append instead of 'merge'.\r\n\r\nand the 'merge' function add space between sql part automatically.\r\n\r\n`\r\nvar where;\r\n    if(keyword){\r\n        where=SQL`where phone like ${'%'+keyword+'%'}`;\r\n    }\r\n    var [{total}]=await mysql.query(SQL.merge(SQL`select count(*) as total from .user`, where));\r\n    var list=await mysql.query(SQL.merge(SQL`SELECT * from .user `, where, SQL`limit 10 offset ${offset}`));\r\n   // or the line above would be \r\n  var list=await mysql.query(SQL`SELECT * from .user `.append(where).append(SQL`limit 10 offset ${offset}`));\r\n`\r\n"}}
{"actor":{"display_login":"taojoe"}}