{"action":"created","comment":{"url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/comments/191039428","pull_request_review_id":123547115,"id":191039428,"diff_hunk":"@@ -0,0 +1,71 @@\n+/*\n+ * Copyright 2016 rdbc contributors\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package io.rdbc.pgsql.core.internal.typeconv\n+\n+import io.rdbc.pgsql.core.internal.typeconv.extractors._\n+import io.rdbc.pgsql.core.typeconv.PartialTypeConverter\n+import io.rdbc.sapi.DecimalNumber\n+\n+private[typeconv] object BoolTypeConverter\n+  extends PartialTypeConverter[Boolean] {\n+\n+  val cls = classOf[Boolean]\n+\n+  def convert(any: Any): Option[Boolean] = {\n+    any match {\n+      case BoolVal(b) => Some(b)\n+      case ByteVal(b) => num2Bool(b)\n+      case ShortVal(s) => num2Bool(s)\n+      case IntVal(i) => num2Bool(i)\n+      case LongVal(l) => num2Bool(l)\n+      case DecimalNumberVal(dn) => decimal2Bool(dn)\n+      case CharVal(c) => char2Bool(c)\n+      case StringVal(s) => str2Bool(s)\n+      case _ => None\n+    }\n+  }\n+\n+  private def num2Bool(n: java.lang.Number): Option[Boolean] = {\n+    n.doubleValue() match {\n+      case 1.0 => Some(true)\n+      case 0.0 => Some(false)\n+      case _ => None\n+    }\n+  }\n+\n+  private def decimal2Bool(dn: DecimalNumber): Option[Boolean] = {\n+    dn match {\n+      case DecimalNumber.Val(bd) => num2Bool(bd)\n+      case _ => None\n+    }\n+  }\n+\n+  private def str2Bool(str: String): Option[Boolean] = {\n+    if (str.length == 1) {\n+      char2Bool(str.head)\n+    } else {\n+      None\n+    }\n+  }\n+\n+  private def char2Bool(char: Char): Option[Boolean] = {\n+    if (char == '1' || char == 'T' || char == 'Y') Some(true)","path":"rdbc-pgsql-core/src/main/scala/io/rdbc/pgsql/core/internal/typeconv/BoolTypeConverter.scala","position":66,"original_position":66,"commit_id":"81d983f3c3ab8b806eeba211c7957b17d8414e35","original_commit_id":"81d983f3c3ab8b806eeba211c7957b17d8414e35","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Consider using case matching instead of else if blocks](https://app.codacy.com/app/povder/rdbc-pgsql/pullRequest?prid=1699486)","created_at":"2018-05-26T04:29:25Z","updated_at":"2018-05-26T04:29:26Z","html_url":"https://github.com/rdbc-io/rdbc-pgsql/pull/149#discussion_r191039428","pull_request_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/comments/191039428"},"html":{"href":"https://github.com/rdbc-io/rdbc-pgsql/pull/149#discussion_r191039428"},"pull_request":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149"}}},"pull_request":{"url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149","id":190724929,"html_url":"https://github.com/rdbc-io/rdbc-pgsql/pull/149","diff_url":"https://github.com/rdbc-io/rdbc-pgsql/pull/149.diff","patch_url":"https://github.com/rdbc-io/rdbc-pgsql/pull/149.patch","issue_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/149","number":149,"state":"open","locked":false,"title":"Type handling overhaul","user":{"login":"povder","id":16050375,"avatar_url":"https://avatars2.githubusercontent.com/u/16050375?v=4","gravatar_id":"","url":"https://api.github.com/users/povder","html_url":"https://github.com/povder","followers_url":"https://api.github.com/users/povder/followers","following_url":"https://api.github.com/users/povder/following{/other_user}","gists_url":"https://api.github.com/users/povder/gists{/gist_id}","starred_url":"https://api.github.com/users/povder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/povder/subscriptions","organizations_url":"https://api.github.com/users/povder/orgs","repos_url":"https://api.github.com/users/povder/repos","events_url":"https://api.github.com/users/povder/events{/privacy}","received_events_url":"https://api.github.com/users/povder/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-26T04:25:22Z","updated_at":"2018-05-26T04:29:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ff63f586cb02bfda2726117a0a4302c89a59573","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149/commits","review_comments_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149/comments","review_comment_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/149/comments","statuses_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/statuses/81d983f3c3ab8b806eeba211c7957b17d8414e35","head":{"label":"rdbc-io:types_rework","ref":"types_rework","sha":"81d983f3c3ab8b806eeba211c7957b17d8414e35","user":{"login":"rdbc-io","id":22240585,"avatar_url":"https://avatars1.githubusercontent.com/u/22240585?v=4","gravatar_id":"","url":"https://api.github.com/users/rdbc-io","html_url":"https://github.com/rdbc-io","followers_url":"https://api.github.com/users/rdbc-io/followers","following_url":"https://api.github.com/users/rdbc-io/following{/other_user}","gists_url":"https://api.github.com/users/rdbc-io/gists{/gist_id}","starred_url":"https://api.github.com/users/rdbc-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdbc-io/subscriptions","organizations_url":"https://api.github.com/users/rdbc-io/orgs","repos_url":"https://api.github.com/users/rdbc-io/repos","events_url":"https://api.github.com/users/rdbc-io/events{/privacy}","received_events_url":"https://api.github.com/users/rdbc-io/received_events","type":"Organization","site_admin":false},"repo":{"id":68448067,"name":"rdbc-pgsql","full_name":"rdbc-io/rdbc-pgsql","owner":{"login":"rdbc-io","id":22240585,"avatar_url":"https://avatars1.githubusercontent.com/u/22240585?v=4","gravatar_id":"","url":"https://api.github.com/users/rdbc-io","html_url":"https://github.com/rdbc-io","followers_url":"https://api.github.com/users/rdbc-io/followers","following_url":"https://api.github.com/users/rdbc-io/following{/other_user}","gists_url":"https://api.github.com/users/rdbc-io/gists{/gist_id}","starred_url":"https://api.github.com/users/rdbc-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdbc-io/subscriptions","organizations_url":"https://api.github.com/users/rdbc-io/orgs","repos_url":"https://api.github.com/users/rdbc-io/repos","events_url":"https://api.github.com/users/rdbc-io/events{/privacy}","received_events_url":"https://api.github.com/users/rdbc-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rdbc-io/rdbc-pgsql","description":"Asynchronous database access for Scala and Java - PostgreSQL driver","fork":false,"url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql","forks_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/forks","keys_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/teams","hooks_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/hooks","issue_events_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/events{/number}","events_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/events","assignees_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/assignees{/user}","branches_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/branches{/branch}","tags_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/tags","blobs_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/refs{/sha}","trees_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/statuses/{sha}","languages_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/languages","stargazers_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/stargazers","contributors_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/contributors","subscribers_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/subscribers","subscription_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/subscription","commits_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/commits{/sha}","git_commits_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/commits{/sha}","comments_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/comments{/number}","issue_comment_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/comments{/number}","contents_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/contents/{+path}","compare_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/merges","archive_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/downloads","issues_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues{/number}","pulls_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls{/number}","milestones_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/milestones{/number}","notifications_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/labels{/name}","releases_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/releases{/id}","deployments_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/deployments","created_at":"2016-09-17T11:24:21Z","updated_at":"2018-04-29T04:51:20Z","pushed_at":"2018-05-26T04:25:23Z","git_url":"git://github.com/rdbc-io/rdbc-pgsql.git","ssh_url":"git@github.com:rdbc-io/rdbc-pgsql.git","clone_url":"https://github.com/rdbc-io/rdbc-pgsql.git","svn_url":"https://github.com/rdbc-io/rdbc-pgsql","homepage":"http://rdbc.io","size":719,"stargazers_count":4,"watchers_count":4,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":10,"watchers":4,"default_branch":"master"}},"base":{"label":"rdbc-io:master","ref":"master","sha":"8446a0b8876cf7ff9fe0e781699b36e09fb65dda","user":{"login":"rdbc-io","id":22240585,"avatar_url":"https://avatars1.githubusercontent.com/u/22240585?v=4","gravatar_id":"","url":"https://api.github.com/users/rdbc-io","html_url":"https://github.com/rdbc-io","followers_url":"https://api.github.com/users/rdbc-io/followers","following_url":"https://api.github.com/users/rdbc-io/following{/other_user}","gists_url":"https://api.github.com/users/rdbc-io/gists{/gist_id}","starred_url":"https://api.github.com/users/rdbc-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdbc-io/subscriptions","organizations_url":"https://api.github.com/users/rdbc-io/orgs","repos_url":"https://api.github.com/users/rdbc-io/repos","events_url":"https://api.github.com/users/rdbc-io/events{/privacy}","received_events_url":"https://api.github.com/users/rdbc-io/received_events","type":"Organization","site_admin":false},"repo":{"id":68448067,"name":"rdbc-pgsql","full_name":"rdbc-io/rdbc-pgsql","owner":{"login":"rdbc-io","id":22240585,"avatar_url":"https://avatars1.githubusercontent.com/u/22240585?v=4","gravatar_id":"","url":"https://api.github.com/users/rdbc-io","html_url":"https://github.com/rdbc-io","followers_url":"https://api.github.com/users/rdbc-io/followers","following_url":"https://api.github.com/users/rdbc-io/following{/other_user}","gists_url":"https://api.github.com/users/rdbc-io/gists{/gist_id}","starred_url":"https://api.github.com/users/rdbc-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdbc-io/subscriptions","organizations_url":"https://api.github.com/users/rdbc-io/orgs","repos_url":"https://api.github.com/users/rdbc-io/repos","events_url":"https://api.github.com/users/rdbc-io/events{/privacy}","received_events_url":"https://api.github.com/users/rdbc-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rdbc-io/rdbc-pgsql","description":"Asynchronous database access for Scala and Java - PostgreSQL driver","fork":false,"url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql","forks_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/forks","keys_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/teams","hooks_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/hooks","issue_events_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/events{/number}","events_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/events","assignees_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/assignees{/user}","branches_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/branches{/branch}","tags_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/tags","blobs_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/refs{/sha}","trees_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/statuses/{sha}","languages_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/languages","stargazers_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/stargazers","contributors_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/contributors","subscribers_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/subscribers","subscription_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/subscription","commits_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/commits{/sha}","git_commits_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/git/commits{/sha}","comments_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/comments{/number}","issue_comment_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/comments{/number}","contents_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/contents/{+path}","compare_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/merges","archive_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/downloads","issues_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues{/number}","pulls_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls{/number}","milestones_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/milestones{/number}","notifications_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/labels{/name}","releases_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/releases{/id}","deployments_url":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/deployments","created_at":"2016-09-17T11:24:21Z","updated_at":"2018-04-29T04:51:20Z","pushed_at":"2018-05-26T04:25:23Z","git_url":"git://github.com/rdbc-io/rdbc-pgsql.git","ssh_url":"git@github.com:rdbc-io/rdbc-pgsql.git","clone_url":"https://github.com/rdbc-io/rdbc-pgsql.git","svn_url":"https://github.com/rdbc-io/rdbc-pgsql","homepage":"http://rdbc.io","size":719,"stargazers_count":4,"watchers_count":4,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":10,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149"},"html":{"href":"https://github.com/rdbc-io/rdbc-pgsql/pull/149"},"issue":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/149"},"comments":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/issues/149/comments"},"review_comments":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149/comments"},"review_comment":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/pulls/149/commits"},"statuses":{"href":"https://api.github.com/repos/rdbc-io/rdbc-pgsql/statuses/81d983f3c3ab8b806eeba211c7957b17d8414e35"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}