{"action":"created","comment":{"url":"https://api.github.com/repos/juttle/redis-backend/pulls/comments/46647529","id":46647529,"diff_hunk":"@@ -0,0 +1,93 @@\n+var Promise = require('bluebird');\n+var Redis = require('redis-fast-driver');\n+var transformations = require('./redis-result-transformation-functions');\n+\n+var juttle_utils = require('juttle/lib/runtime').utils;\n+\n+function RedisBackend(config, JuttleRuntime) {\n+    var redis = Promise.promisifyAll(new Redis(config));\n+    var connect_promise = new Promise(function(resolve, reject) {\n+        redis.on('ready', resolve);\n+        redis.on('error', reject);\n+    });\n+\n+    var Read = JuttleRuntime.proc.base.extend({\n+        procName: 'redis_read',\n+        sourceType: 'batch',\n+\n+        initialize: function(options, params) {\n+            if (!options.hasOwnProperty('raw')) {\n+                throw new Error('must specify a redis query with -raw');\n+            }\n+\n+            this.command = options.raw.split(' ');\n+        },\n+\n+        start: function() {\n+            var self = this;\n+            var keyword = this.command[0].toLowerCase();\n+\n+            if (!transformations.hasOwnProperty(keyword)) {\n+                return self.trigger('error', new Error('unsupported/invalid Redis command: ', keyword));\n+            }\n+            return connect_promise.then(function() {\n+                return redis.rawCallAsync(self.command);\n+            })\n+            .then(function(result) {\n+                var points = transformations[keyword](self.command, result);\n+\n+                self.emit(points);\n+                self.emit_eof();\n+            })\n+            .catch(function(err) {\n+                self.trigger('error', new Error(err.message));","path":"lib/index.js","position":43,"original_position":43,"commit_id":"906eda66777b23c269d3a601415e5173cea7660a","original_commit_id":"906eda66777b23c269d3a601415e5173cea7660a","user":{"login":"VladVega","id":661577,"avatar_url":"https://avatars.githubusercontent.com/u/661577?v=3","gravatar_id":"","url":"https://api.github.com/users/VladVega","html_url":"https://github.com/VladVega","followers_url":"https://api.github.com/users/VladVega/followers","following_url":"https://api.github.com/users/VladVega/following{/other_user}","gists_url":"https://api.github.com/users/VladVega/gists{/gist_id}","starred_url":"https://api.github.com/users/VladVega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladVega/subscriptions","organizations_url":"https://api.github.com/users/VladVega/orgs","repos_url":"https://api.github.com/users/VladVega/repos","events_url":"https://api.github.com/users/VladVega/events{/privacy}","received_events_url":"https://api.github.com/users/VladVega/received_events","type":"User","site_admin":false},"body":"Do we eventually want a runtime error here?","created_at":"2015-12-04T04:09:54Z","updated_at":"2015-12-04T04:09:54Z","html_url":"https://github.com/juttle/redis-backend/pull/1#discussion_r46647529","pull_request_url":"https://api.github.com/repos/juttle/redis-backend/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/juttle/redis-backend/pulls/comments/46647529"},"html":{"href":"https://github.com/juttle/redis-backend/pull/1#discussion_r46647529"},"pull_request":{"href":"https://api.github.com/repos/juttle/redis-backend/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/juttle/redis-backend/pulls/1","id":52475270,"html_url":"https://github.com/juttle/redis-backend/pull/1","diff_url":"https://github.com/juttle/redis-backend/pull/1.diff","patch_url":"https://github.com/juttle/redis-backend/pull/1.patch","issue_url":"https://api.github.com/repos/juttle/redis-backend/issues/1","number":1,"state":"open","locked":false,"title":"Minimal Redis backend","user":{"login":"davidvgalbraith","id":2757844,"avatar_url":"https://avatars.githubusercontent.com/u/2757844?v=3","gravatar_id":"","url":"https://api.github.com/users/davidvgalbraith","html_url":"https://github.com/davidvgalbraith","followers_url":"https://api.github.com/users/davidvgalbraith/followers","following_url":"https://api.github.com/users/davidvgalbraith/following{/other_user}","gists_url":"https://api.github.com/users/davidvgalbraith/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvgalbraith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvgalbraith/subscriptions","organizations_url":"https://api.github.com/users/davidvgalbraith/orgs","repos_url":"https://api.github.com/users/davidvgalbraith/repos","events_url":"https://api.github.com/users/davidvgalbraith/events{/privacy}","received_events_url":"https://api.github.com/users/davidvgalbraith/received_events","type":"User","site_admin":false},"body":"All it supports is HMSET and HMGET, but it has the infrastructure to add more commands. I'll get working on that presently, but opening this up for review now. See https://jut-io.atlassian.net/wiki/display/JUT20/Jut+for+Redis for the full plan.\r\n\r\nThe driver we use only works on 0.10 until the Guy merges https://github.com/h0x91b/redis-fast-driver/pull/2. Can't seem to `npm install juttle/juttle` with 0.10, so Travis is grumpy.\r\n\r\n@demmer @VladVega @bkutil","created_at":"2015-12-03T00:23:15Z","updated_at":"2015-12-04T04:09:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7760b93b90bd2e47f39e46ed201a108a92825db","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/juttle/redis-backend/pulls/1/commits","review_comments_url":"https://api.github.com/repos/juttle/redis-backend/pulls/1/comments","review_comment_url":"https://api.github.com/repos/juttle/redis-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juttle/redis-backend/issues/1/comments","statuses_url":"https://api.github.com/repos/juttle/redis-backend/statuses/906eda66777b23c269d3a601415e5173cea7660a","head":{"label":"juttle:do-redis","ref":"do-redis","sha":"906eda66777b23c269d3a601415e5173cea7660a","user":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"repo":{"id":46780365,"name":"redis-backend","full_name":"juttle/redis-backend","owner":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juttle/redis-backend","description":"A redis backend for Juttle","fork":false,"url":"https://api.github.com/repos/juttle/redis-backend","forks_url":"https://api.github.com/repos/juttle/redis-backend/forks","keys_url":"https://api.github.com/repos/juttle/redis-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juttle/redis-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juttle/redis-backend/teams","hooks_url":"https://api.github.com/repos/juttle/redis-backend/hooks","issue_events_url":"https://api.github.com/repos/juttle/redis-backend/issues/events{/number}","events_url":"https://api.github.com/repos/juttle/redis-backend/events","assignees_url":"https://api.github.com/repos/juttle/redis-backend/assignees{/user}","branches_url":"https://api.github.com/repos/juttle/redis-backend/branches{/branch}","tags_url":"https://api.github.com/repos/juttle/redis-backend/tags","blobs_url":"https://api.github.com/repos/juttle/redis-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juttle/redis-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juttle/redis-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/juttle/redis-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juttle/redis-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/juttle/redis-backend/languages","stargazers_url":"https://api.github.com/repos/juttle/redis-backend/stargazers","contributors_url":"https://api.github.com/repos/juttle/redis-backend/contributors","subscribers_url":"https://api.github.com/repos/juttle/redis-backend/subscribers","subscription_url":"https://api.github.com/repos/juttle/redis-backend/subscription","commits_url":"https://api.github.com/repos/juttle/redis-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/juttle/redis-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/juttle/redis-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/juttle/redis-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/juttle/redis-backend/contents/{+path}","compare_url":"https://api.github.com/repos/juttle/redis-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juttle/redis-backend/merges","archive_url":"https://api.github.com/repos/juttle/redis-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juttle/redis-backend/downloads","issues_url":"https://api.github.com/repos/juttle/redis-backend/issues{/number}","pulls_url":"https://api.github.com/repos/juttle/redis-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/juttle/redis-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/juttle/redis-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juttle/redis-backend/labels{/name}","releases_url":"https://api.github.com/repos/juttle/redis-backend/releases{/id}","created_at":"2015-11-24T09:18:14Z","updated_at":"2015-11-24T09:18:14Z","pushed_at":"2015-12-03T21:35:55Z","git_url":"git://github.com/juttle/redis-backend.git","ssh_url":"git@github.com:juttle/redis-backend.git","clone_url":"https://github.com/juttle/redis-backend.git","svn_url":"https://github.com/juttle/redis-backend","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"juttle:master","ref":"master","sha":"54fcaf1ae9e5e4d429e5a27b0d96d5ff00555838","user":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"repo":{"id":46780365,"name":"redis-backend","full_name":"juttle/redis-backend","owner":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juttle/redis-backend","description":"A redis backend for Juttle","fork":false,"url":"https://api.github.com/repos/juttle/redis-backend","forks_url":"https://api.github.com/repos/juttle/redis-backend/forks","keys_url":"https://api.github.com/repos/juttle/redis-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juttle/redis-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juttle/redis-backend/teams","hooks_url":"https://api.github.com/repos/juttle/redis-backend/hooks","issue_events_url":"https://api.github.com/repos/juttle/redis-backend/issues/events{/number}","events_url":"https://api.github.com/repos/juttle/redis-backend/events","assignees_url":"https://api.github.com/repos/juttle/redis-backend/assignees{/user}","branches_url":"https://api.github.com/repos/juttle/redis-backend/branches{/branch}","tags_url":"https://api.github.com/repos/juttle/redis-backend/tags","blobs_url":"https://api.github.com/repos/juttle/redis-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juttle/redis-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juttle/redis-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/juttle/redis-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juttle/redis-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/juttle/redis-backend/languages","stargazers_url":"https://api.github.com/repos/juttle/redis-backend/stargazers","contributors_url":"https://api.github.com/repos/juttle/redis-backend/contributors","subscribers_url":"https://api.github.com/repos/juttle/redis-backend/subscribers","subscription_url":"https://api.github.com/repos/juttle/redis-backend/subscription","commits_url":"https://api.github.com/repos/juttle/redis-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/juttle/redis-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/juttle/redis-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/juttle/redis-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/juttle/redis-backend/contents/{+path}","compare_url":"https://api.github.com/repos/juttle/redis-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juttle/redis-backend/merges","archive_url":"https://api.github.com/repos/juttle/redis-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juttle/redis-backend/downloads","issues_url":"https://api.github.com/repos/juttle/redis-backend/issues{/number}","pulls_url":"https://api.github.com/repos/juttle/redis-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/juttle/redis-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/juttle/redis-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juttle/redis-backend/labels{/name}","releases_url":"https://api.github.com/repos/juttle/redis-backend/releases{/id}","created_at":"2015-11-24T09:18:14Z","updated_at":"2015-11-24T09:18:14Z","pushed_at":"2015-12-03T21:35:55Z","git_url":"git://github.com/juttle/redis-backend.git","ssh_url":"git@github.com:juttle/redis-backend.git","clone_url":"https://github.com/juttle/redis-backend.git","svn_url":"https://github.com/juttle/redis-backend","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juttle/redis-backend/pulls/1"},"html":{"href":"https://github.com/juttle/redis-backend/pull/1"},"issue":{"href":"https://api.github.com/repos/juttle/redis-backend/issues/1"},"comments":{"href":"https://api.github.com/repos/juttle/redis-backend/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/juttle/redis-backend/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/juttle/redis-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juttle/redis-backend/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/juttle/redis-backend/statuses/906eda66777b23c269d3a601415e5173cea7660a"}}}}