{"action":"created","comment":{"url":"https://api.github.com/repos/hailocab/gocassa/pulls/comments/26295723","id":26295723,"diff_hunk":"@@ -0,0 +1,145 @@\n+package gocassa\n+\n+import (\n+\t\"bytes\"\n+\t\"fmt\"\n+\t\"strings\"\n+)\n+\n+// Modifiers are used with update statements.\n+\n+const (\n+\tmodifierListPrepend = iota\n+\tmodifierListAppend\n+\tmodifierListSetAtIndex\n+\tmodifierListRemove\n+\tmodifierListRemoveAtIndex\n+\tmodifierMapSetFields\n+\tmodifierMapSetField\n+\tmodifierMapReplace\n+\tmodifierMapDeleteField\n+\tmodifierCounterAdd\n+)\n+\n+type Modifier struct {\n+\top   int\n+\targs []interface{}\n+}\n+\n+// Prepend a value to the front of the list\n+func ListPrepend(value interface{}) Modifier {\n+\treturn Modifier{\n+\t\top:   modifierListPrepend,\n+\t\targs: []interface{}{value},\n+\t}\n+}\n+\n+// Append a value to the end of the list\n+func ListAppend(value interface{}) Modifier {\n+\treturn Modifier{\n+\t\top:   modifierListAppend,\n+\t\targs: []interface{}{value},\n+\t}\n+}\n+\n+// Sets list element at index to value\n+func ListSetAtIndex(index int, value interface{}) Modifier {\n+\treturn Modifier{\n+\t\top:   modifierListSetAtIndex,\n+\t\targs: []interface{}{index, value},\n+\t}\n+}\n+\n+// Remove all elements having a particular value\n+func ListRemove(value interface{}) Modifier {\n+\treturn Modifier{\n+\t\top:   modifierListRemove,\n+\t\targs: []interface{}{value},\n+\t}\n+}\n+\n+// This uses DELETE, not UPDATE\n+// Removes an element at a specific index from the list\n+// func ListRemoveAtIndex(index int, value interface{}) Modifier {\n+// \treturn Modifier{\n+// \t\top:   ModifierListRemove,\n+// \t\targs: []interface{}{index, value},\n+// \t}\n+// }\n+\n+func MapSetFields(fields map[string]interface{}) Modifier {\n+\treturn Modifier{\n+\t\top:   modifierMapSetFields,\n+\t\targs: []interface{}{fields},\n+\t}\n+}\n+\n+// @todo MapReplace\n+// @todo MapDelete\n+\n+func MapSetField(key, value interface{}) Modifier {\n+\treturn Modifier{\n+\t\top:   modifierMapSetField,\n+\t\targs: []interface{}{key, value},\n+\t}\n+}\n+\n+func CounterAdd(value int) Modifier {","path":"modifiers.go","position":87,"original_position":87,"commit_id":"e159094d84f6be70efa552c99acae35e7ed8afd6","original_commit_id":"4e8880e98449a379b0d0873d50fa15efe37c792b","user":{"login":"crufter","id":1193872,"avatar_url":"https://avatars.githubusercontent.com/u/1193872?v=3","gravatar_id":"","url":"https://api.github.com/users/crufter","html_url":"https://github.com/crufter","followers_url":"https://api.github.com/users/crufter/followers","following_url":"https://api.github.com/users/crufter/following{/other_user}","gists_url":"https://api.github.com/users/crufter/gists{/gist_id}","starred_url":"https://api.github.com/users/crufter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crufter/subscriptions","organizations_url":"https://api.github.com/users/crufter/orgs","repos_url":"https://api.github.com/users/crufter/repos","events_url":"https://api.github.com/users/crufter/events{/privacy}","received_events_url":"https://api.github.com/users/crufter/received_events","type":"User","site_admin":false},"body":"I like that.","created_at":"2015-03-12T11:59:10Z","updated_at":"2015-03-12T11:59:10Z","html_url":"https://github.com/hailocab/gocassa/pull/71#discussion_r26295723","pull_request_url":"https://api.github.com/repos/hailocab/gocassa/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/hailocab/gocassa/pulls/comments/26295723"},"html":{"href":"https://github.com/hailocab/gocassa/pull/71#discussion_r26295723"},"pull_request":{"href":"https://api.github.com/repos/hailocab/gocassa/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/hailocab/gocassa/pulls/71","id":30566991,"html_url":"https://github.com/hailocab/gocassa/pull/71","diff_url":"https://github.com/hailocab/gocassa/pull/71.diff","patch_url":"https://github.com/hailocab/gocassa/pull/71.patch","issue_url":"https://api.github.com/repos/hailocab/gocassa/issues/71","number":71,"state":"open","locked":false,"title":"Supporting slices","user":{"login":"crufter","id":1193872,"avatar_url":"https://avatars.githubusercontent.com/u/1193872?v=3","gravatar_id":"","url":"https://api.github.com/users/crufter","html_url":"https://github.com/crufter","followers_url":"https://api.github.com/users/crufter/followers","following_url":"https://api.github.com/users/crufter/following{/other_user}","gists_url":"https://api.github.com/users/crufter/gists{/gist_id}","starred_url":"https://api.github.com/users/crufter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crufter/subscriptions","organizations_url":"https://api.github.com/users/crufter/orgs","repos_url":"https://api.github.com/users/crufter/repos","events_url":"https://api.github.com/users/crufter/events{/privacy}","received_events_url":"https://api.github.com/users/crufter/received_events","type":"User","site_admin":false},"body":"Done:\r\n- Table creation now supports slices\r\n- List append operation\r\n- List prepend operation\r\n- List remove element operation\r\n- List set list element at position\r\n\r\nGotcha:\r\nSince 'bind variables are not supported inside collection literals', for the first time in the library, values will be part of the query strings. This is a possible security flaw (*QL injection attacks are back!). The way I got around it is doubling all single quotes (delimiters used by Cassandra) in string values as per http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/escape_char_r.html:\r\n\r\n```\r\nTo use a single quotation mark itself in a string literal, escape it using a single quotation mark.\r\n```\r\n\r\nAs a bonus:\r\n- Added support for Maps\r\n- Added support for Counters","created_at":"2015-03-05T15:40:28Z","updated_at":"2015-03-12T11:59:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a6b3ce8de1b4e7d3800cdc25b6854334661b531","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hailocab/gocassa/pulls/71/commits","review_comments_url":"https://api.github.com/repos/hailocab/gocassa/pulls/71/comments","review_comment_url":"https://api.github.com/repos/hailocab/gocassa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hailocab/gocassa/issues/71/comments","statuses_url":"https://api.github.com/repos/hailocab/gocassa/statuses/e159094d84f6be70efa552c99acae35e7ed8afd6","head":{"label":"hailocab:lists","ref":"lists","sha":"e159094d84f6be70efa552c99acae35e7ed8afd6","user":{"login":"hailocab","id":560650,"avatar_url":"https://avatars.githubusercontent.com/u/560650?v=3","gravatar_id":"","url":"https://api.github.com/users/hailocab","html_url":"https://github.com/hailocab","followers_url":"https://api.github.com/users/hailocab/followers","following_url":"https://api.github.com/users/hailocab/following{/other_user}","gists_url":"https://api.github.com/users/hailocab/gists{/gist_id}","starred_url":"https://api.github.com/users/hailocab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hailocab/subscriptions","organizations_url":"https://api.github.com/users/hailocab/orgs","repos_url":"https://api.github.com/users/hailocab/repos","events_url":"https://api.github.com/users/hailocab/events{/privacy}","received_events_url":"https://api.github.com/users/hailocab/received_events","type":"Organization","site_admin":false},"repo":{"id":27129616,"name":"gocassa","full_name":"hailocab/gocassa","owner":{"login":"hailocab","id":560650,"avatar_url":"https://avatars.githubusercontent.com/u/560650?v=3","gravatar_id":"","url":"https://api.github.com/users/hailocab","html_url":"https://github.com/hailocab","followers_url":"https://api.github.com/users/hailocab/followers","following_url":"https://api.github.com/users/hailocab/following{/other_user}","gists_url":"https://api.github.com/users/hailocab/gists{/gist_id}","starred_url":"https://api.github.com/users/hailocab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hailocab/subscriptions","organizations_url":"https://api.github.com/users/hailocab/orgs","repos_url":"https://api.github.com/users/hailocab/repos","events_url":"https://api.github.com/users/hailocab/events{/privacy}","received_events_url":"https://api.github.com/users/hailocab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hailocab/gocassa","description":"A high level Cassandra library in Go, on top of gocql","fork":false,"url":"https://api.github.com/repos/hailocab/gocassa","forks_url":"https://api.github.com/repos/hailocab/gocassa/forks","keys_url":"https://api.github.com/repos/hailocab/gocassa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hailocab/gocassa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hailocab/gocassa/teams","hooks_url":"https://api.github.com/repos/hailocab/gocassa/hooks","issue_events_url":"https://api.github.com/repos/hailocab/gocassa/issues/events{/number}","events_url":"https://api.github.com/repos/hailocab/gocassa/events","assignees_url":"https://api.github.com/repos/hailocab/gocassa/assignees{/user}","branches_url":"https://api.github.com/repos/hailocab/gocassa/branches{/branch}","tags_url":"https://api.github.com/repos/hailocab/gocassa/tags","blobs_url":"https://api.github.com/repos/hailocab/gocassa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hailocab/gocassa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hailocab/gocassa/git/refs{/sha}","trees_url":"https://api.github.com/repos/hailocab/gocassa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hailocab/gocassa/statuses/{sha}","languages_url":"https://api.github.com/repos/hailocab/gocassa/languages","stargazers_url":"https://api.github.com/repos/hailocab/gocassa/stargazers","contributors_url":"https://api.github.com/repos/hailocab/gocassa/contributors","subscribers_url":"https://api.github.com/repos/hailocab/gocassa/subscribers","subscription_url":"https://api.github.com/repos/hailocab/gocassa/subscription","commits_url":"https://api.github.com/repos/hailocab/gocassa/commits{/sha}","git_commits_url":"https://api.github.com/repos/hailocab/gocassa/git/commits{/sha}","comments_url":"https://api.github.com/repos/hailocab/gocassa/comments{/number}","issue_comment_url":"https://api.github.com/repos/hailocab/gocassa/issues/comments{/number}","contents_url":"https://api.github.com/repos/hailocab/gocassa/contents/{+path}","compare_url":"https://api.github.com/repos/hailocab/gocassa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hailocab/gocassa/merges","archive_url":"https://api.github.com/repos/hailocab/gocassa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hailocab/gocassa/downloads","issues_url":"https://api.github.com/repos/hailocab/gocassa/issues{/number}","pulls_url":"https://api.github.com/repos/hailocab/gocassa/pulls{/number}","milestones_url":"https://api.github.com/repos/hailocab/gocassa/milestones{/number}","notifications_url":"https://api.github.com/repos/hailocab/gocassa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hailocab/gocassa/labels{/name}","releases_url":"https://api.github.com/repos/hailocab/gocassa/releases{/id}","created_at":"2014-11-25T14:32:04Z","updated_at":"2015-03-11T22:08:15Z","pushed_at":"2015-03-12T11:44:36Z","git_url":"git://github.com/hailocab/gocassa.git","ssh_url":"git@github.com:hailocab/gocassa.git","clone_url":"https://github.com/hailocab/gocassa.git","svn_url":"https://github.com/hailocab/gocassa","homepage":"","size":1426,"stargazers_count":109,"watchers_count":109,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":109,"default_branch":"master"}},"base":{"label":"hailocab:master","ref":"master","sha":"cc1d6c0b9c62c931740732beed6d76d890662a05","user":{"login":"hailocab","id":560650,"avatar_url":"https://avatars.githubusercontent.com/u/560650?v=3","gravatar_id":"","url":"https://api.github.com/users/hailocab","html_url":"https://github.com/hailocab","followers_url":"https://api.github.com/users/hailocab/followers","following_url":"https://api.github.com/users/hailocab/following{/other_user}","gists_url":"https://api.github.com/users/hailocab/gists{/gist_id}","starred_url":"https://api.github.com/users/hailocab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hailocab/subscriptions","organizations_url":"https://api.github.com/users/hailocab/orgs","repos_url":"https://api.github.com/users/hailocab/repos","events_url":"https://api.github.com/users/hailocab/events{/privacy}","received_events_url":"https://api.github.com/users/hailocab/received_events","type":"Organization","site_admin":false},"repo":{"id":27129616,"name":"gocassa","full_name":"hailocab/gocassa","owner":{"login":"hailocab","id":560650,"avatar_url":"https://avatars.githubusercontent.com/u/560650?v=3","gravatar_id":"","url":"https://api.github.com/users/hailocab","html_url":"https://github.com/hailocab","followers_url":"https://api.github.com/users/hailocab/followers","following_url":"https://api.github.com/users/hailocab/following{/other_user}","gists_url":"https://api.github.com/users/hailocab/gists{/gist_id}","starred_url":"https://api.github.com/users/hailocab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hailocab/subscriptions","organizations_url":"https://api.github.com/users/hailocab/orgs","repos_url":"https://api.github.com/users/hailocab/repos","events_url":"https://api.github.com/users/hailocab/events{/privacy}","received_events_url":"https://api.github.com/users/hailocab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hailocab/gocassa","description":"A high level Cassandra library in Go, on top of gocql","fork":false,"url":"https://api.github.com/repos/hailocab/gocassa","forks_url":"https://api.github.com/repos/hailocab/gocassa/forks","keys_url":"https://api.github.com/repos/hailocab/gocassa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hailocab/gocassa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hailocab/gocassa/teams","hooks_url":"https://api.github.com/repos/hailocab/gocassa/hooks","issue_events_url":"https://api.github.com/repos/hailocab/gocassa/issues/events{/number}","events_url":"https://api.github.com/repos/hailocab/gocassa/events","assignees_url":"https://api.github.com/repos/hailocab/gocassa/assignees{/user}","branches_url":"https://api.github.com/repos/hailocab/gocassa/branches{/branch}","tags_url":"https://api.github.com/repos/hailocab/gocassa/tags","blobs_url":"https://api.github.com/repos/hailocab/gocassa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hailocab/gocassa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hailocab/gocassa/git/refs{/sha}","trees_url":"https://api.github.com/repos/hailocab/gocassa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hailocab/gocassa/statuses/{sha}","languages_url":"https://api.github.com/repos/hailocab/gocassa/languages","stargazers_url":"https://api.github.com/repos/hailocab/gocassa/stargazers","contributors_url":"https://api.github.com/repos/hailocab/gocassa/contributors","subscribers_url":"https://api.github.com/repos/hailocab/gocassa/subscribers","subscription_url":"https://api.github.com/repos/hailocab/gocassa/subscription","commits_url":"https://api.github.com/repos/hailocab/gocassa/commits{/sha}","git_commits_url":"https://api.github.com/repos/hailocab/gocassa/git/commits{/sha}","comments_url":"https://api.github.com/repos/hailocab/gocassa/comments{/number}","issue_comment_url":"https://api.github.com/repos/hailocab/gocassa/issues/comments{/number}","contents_url":"https://api.github.com/repos/hailocab/gocassa/contents/{+path}","compare_url":"https://api.github.com/repos/hailocab/gocassa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hailocab/gocassa/merges","archive_url":"https://api.github.com/repos/hailocab/gocassa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hailocab/gocassa/downloads","issues_url":"https://api.github.com/repos/hailocab/gocassa/issues{/number}","pulls_url":"https://api.github.com/repos/hailocab/gocassa/pulls{/number}","milestones_url":"https://api.github.com/repos/hailocab/gocassa/milestones{/number}","notifications_url":"https://api.github.com/repos/hailocab/gocassa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hailocab/gocassa/labels{/name}","releases_url":"https://api.github.com/repos/hailocab/gocassa/releases{/id}","created_at":"2014-11-25T14:32:04Z","updated_at":"2015-03-11T22:08:15Z","pushed_at":"2015-03-12T11:44:36Z","git_url":"git://github.com/hailocab/gocassa.git","ssh_url":"git@github.com:hailocab/gocassa.git","clone_url":"https://github.com/hailocab/gocassa.git","svn_url":"https://github.com/hailocab/gocassa","homepage":"","size":1426,"stargazers_count":109,"watchers_count":109,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hailocab/gocassa/pulls/71"},"html":{"href":"https://github.com/hailocab/gocassa/pull/71"},"issue":{"href":"https://api.github.com/repos/hailocab/gocassa/issues/71"},"comments":{"href":"https://api.github.com/repos/hailocab/gocassa/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/hailocab/gocassa/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/hailocab/gocassa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hailocab/gocassa/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/hailocab/gocassa/statuses/e159094d84f6be70efa552c99acae35e7ed8afd6"}}}}