Created
July 22, 2015 09:58
-
-
Save wende/6403bab1377254c34dc5 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
| gen_query(git, Data = #git{}) -> | |
| Query_Git = "insert into erlproject_git " ++ | |
| " (id, name, full_name, owner_id, html_url, description," ++ | |
| " created_at, updated_at, pushed_at , clone_url," ++ | |
| " stars, open_issues, forks, source) values ('" ++ | |
| integer_to_list(Data#git.id) ++ "' , '" ++ | |
| Data#git.name ++ "' , '" ++ | |
| Data#git.full_name ++ "' , '" ++ | |
| integer_to_list(Data#git.owner#owner.id) ++ "' , '" ++ | |
| Data#git.html_url ++ "' , '" ++ | |
| fix(Data#git.description) ++ "' , '" ++ | |
| % Data#git.languages ++ "' , '" ++ | |
| Data#git.created_at ++ "' , '" ++ | |
| Data#git.updated_at ++ "' , '" ++ | |
| Data#git.pushed_at ++ "' , '" ++ | |
| Data#git.clone_url ++ "' , '" ++ | |
| integer_to_list(Data#git.watchers) ++ "' , '" ++ | |
| integer_to_list(Data#git.open_issues) ++ "' , '" ++ | |
| integer_to_list(Data#git.forks) ++ | |
| "' , 'github') on duplicate key update " ++ | |
| " forks = '" ++ integer_to_list(Data#git.forks) ++ | |
| "' , stars = '" ++ integer_to_list(Data#git.watchers) ++ | |
| "' , open_issues = '" ++ integer_to_list(Data#git.open_issues) ++ | |
| "' , pushed_at = '" ++ Data#git.pushed_at ++ | |
| "' , updated_at = '" ++ Data#git.updated_at ++ | |
| "' , clone_url = '" ++ Data#git.clone_url ++ "'", | |
| Query_Owner = "insert into erlproject_owner " ++ | |
| " (id, login, avatar_url, url) values (' " ++ | |
| integer_to_list(Data#git.owner#owner.id) ++ "' , '" ++ | |
| Data#git.owner#owner.login ++ "' , '" ++ | |
| Data#git.owner#owner.avatar_url ++ "' , '" ++ | |
| Data#git.owner#owner.url ++ "') " ++ | |
| " on duplicate key update url = ' " ++ | |
| Data#git.owner#owner.url ++ "' ", | |
| {Query_Git, Query_Owner}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment