{"id":13502731,"url":"https://github.com/MaxMorais/Code2Case","last_synced_at":"2025-03-29T12:32:43.869Z","repository":{"id":4786541,"uuid":"5938878","full_name":"MaxMorais/Code2Case","owner":"MaxMorais","description":"Web2Py Puglin to easy convert slowest VirtualFields to agile case columns","archived":false,"fork":false,"pushed_at":"2013-10-18T14:07:58.000Z","size":108,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-01T22:57:30.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaxMorais.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-24T18:28:22.000Z","updated_at":"2017-03-20T19:44:21.000Z","dependencies_parsed_at":"2022-09-10T16:50:28.507Z","dependency_job_id":null,"html_url":"https://github.com/MaxMorais/Code2Case","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxMorais%2FCode2Case","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxMorais%2FCode2Case/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxMorais%2FCode2Case/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxMorais%2FCode2Case/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxMorais","download_url":"https://codeload.github.com/MaxMorais/Code2Case/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222495197,"owners_count":16993286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:02:23.611Z","updated_at":"2024-10-31T22:30:50.313Z","avatar_url":"https://github.com/MaxMorais.png","language":"Python","readme":"Code2Case\n=========\n\nWeb2py Plugin for easy conversion of slow virtual columns for agile columns case\nThis plugin uses the standard module dis, allowing disassembly of python code and building columns in sql case\n\n\n[pt-Br] Web2Py Plugin para fácil conversão de colunas virtuais lentas para colunas sql case ágeis\nEste plugin usa o módulo padrão dis, que permite a desmontagem (disassembly) do código python e a construção de colunas case em sql\n\nEg. (Ex):\n\n```python\ndef main():\n  from case import Case\n  def myfunc():\n    if db.mytable.myfield == 0:\n      return 'A'\n    elif db.mytable.myfield == 1:\n      return 'B'\n    else:\n      return 'C'\n\nprint(db()._select(db.mytable.ALL, Case(myfunc))\n```\n\n```sql\nSELECT CASE WHEN (mytable.myfield = 0) THEN 'A' ELSE CASE WHEN (mytable.myfield == 1) THEN 'B' ELSE 'C' END END AS myfunc FROM mytable\n````\n\n```python\n  def myfunc1():\n    if db.mytable.myfield == 0:\n      if db.mytable.myfield1 == 'a':\n        return 1\n      return 0\n    return False\n  myCol = Case(myfunc1)\n  myCol \u003c\u003c \"other_name\"\n\n  print db()._select(db.mytable.ALL, myCol)\n```\n\n```sql\nSELECT CASE WHEN (mytable.myfield = 0) THEN CASE WHEN (mytable.myfield1 == 1) THEN 1 ELSE 0 END ELSE 'F' END AS other_name FROM mytable\n```\n\n```python\ndef myfunc3():\n  if db.mytable.myfield \u003e= 5 or db.mytable.field \u003c 2 :\n    if db.mytable.myfiedl1 == 0 and db.mytable.myfield2 == 1:\n      return 2\n    return 3\n  return 1\n\n```\n\n```sql\nSELECT CASE WHEN ((mytable.myfield \u003e= 5) OR (mytable.myfield \u003c 2)) THEN CASE WHEN ((mytable.myfield1 == 0) AND (mytable.myfield2 == 1) THEN 2 ELSE 3 END ELSE 1 END AS myfunc3 FROM mytable\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaxMorais%2FCode2Case","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMaxMorais%2FCode2Case","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaxMorais%2FCode2Case/lists"}