{"id":16315143,"url":"https://github.com/robrwo/dbix-class-helper-resultset-windowfunctions","last_synced_at":"2025-10-25T17:30:21.484Z","repository":{"id":56838571,"uuid":"134411811","full_name":"robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions","owner":"robrwo","description":"Add support for window functions to DBIx::Class","archived":false,"fork":false,"pushed_at":"2025-01-01T13:18:23.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T09:22:33.808Z","etag":null,"topics":["dbix","perl-module"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/DBIx::Class::Helper::ResultSet::WindowFunctions","language":"Perl","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/robrwo.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-22T12:27:57.000Z","updated_at":"2025-01-01T13:18:27.000Z","dependencies_parsed_at":"2024-12-31T15:37:37.524Z","dependency_job_id":null,"html_url":"https://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.02777777777777779,"last_synced_commit":"bc2808769d9922a8f21c50c7ada17ba0ea639dc7"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrwo%2FDBIx-Class-Helper-ResultSet-WindowFunctions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrwo%2FDBIx-Class-Helper-ResultSet-WindowFunctions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrwo%2FDBIx-Class-Helper-ResultSet-WindowFunctions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrwo%2FDBIx-Class-Helper-ResultSet-WindowFunctions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robrwo","download_url":"https://codeload.github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183513,"owners_count":19430133,"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":["dbix","perl-module"],"created_at":"2024-10-10T21:56:15.692Z","updated_at":"2025-10-25T17:30:21.169Z","avatar_url":"https://github.com/robrwo.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nDBIx::Class::Helper::WindowFunctions - Add support for window functions and aggregate filters to DBIx::Class\n\n# VERSION\n\nversion v0.7.0\n\n# SYNOPSIS\n\nIn a resultset:\n\n```perl\npackage MyApp::Schema::ResultSet::Wobbles;\n\nuse base qw/DBIx::Class::ResultSet/;\n\n__PACKAGE__-\u003eload_components( qw/\n    Helper::WindowFunctions\n/);\n```\n\nUsing the resultset:\n\n```perl\nmy $rs = $schema-\u003eresultset('Wobbles')-\u003esearch_rs(\n  undef,\n  {\n    '+select' =\u003e {\n        avg     =\u003e 'fingers',\n        -filter =\u003e { hats =\u003e { '\u003e', 1 } },\n        -over   =\u003e {\n            partition_by =\u003e 'hats',\n            order_by     =\u003e 'age',\n        },\n    },\n    '+as' =\u003e 'avg',\n  }\n);\n```\n\n# DESCRIPTION\n\nThis helper adds rudimentary support for window functions and aggregate filters to\n[DBIx::Class](https://metacpan.org/pod/DBIx%3A%3AClass) resultsets.\n\nIt adds the following keys to the resultset attributes:\n\n## -over\n\nThis is used for window functions, e.g. the following adds a row number columns\n\n```perl\n'+select' =\u003e {\n    row_number =\u003e [],\n    -over =\u003e {\n       partition_by =\u003e 'class',\n       order_by     =\u003e 'score',\n    },\n},\n```\n\nwhich is equivalent to the SQL\n\n```\nROW_NUMBER() OVER ( PARTITION BY class ORDER BY score )\n```\n\nYou can omit either the `partition_by` or `order_by` clauses.\n\n## -filter\n\nThis is used for filtering aggregate functions or window functions, e.g. the following clause\n\n```perl\n'+select' =\u003e {\n    count     =\u003e \\ 1,\n    -filter =\u003e { kittens =\u003e { '\u003c', 10 } },\n},\n```\n\nis equivalent to the SQL\n\n```\nCOUNT(1) FILTER ( WHERE kittens \u003c 10 )\n```\n\nYou can apply filters to window functions, e.g.\n\n```perl\n'+select' =\u003e {\n    row_number =\u003e [],\n    -filter =\u003e { class =\u003e { -like =\u003e 'A%' } },\n    -over =\u003e {\n       partition_by =\u003e 'class',\n       order_by     =\u003e 'score',\n    },\n},\n```\n\nwhich is equivalent to the SQL\n\n```\nROW_NUMBER() FILTER ( WHERE class like 'A%' ) OVER ( PARTITION BY class ORDER BY score )\n```\n\nThe `-filter` feature was added v0.6.0.\n\n# CAVEATS\n\nThis module is experimental.\n\nNot all databases support window functions.\n\n# SUPPORT FOR OLDER PERL VERSIONS\n\nSince v0.7.0, the this module requires Perl v5.20 or later.\n\nFuture releases may only support Perl versions released in the last ten years.\n\n# SEE ALSO\n\n[DBIx::Class](https://metacpan.org/pod/DBIx%3A%3AClass)\n\n# SOURCE\n\nThe development version is on github at [https://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions](https://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions)\nand may be cloned from [git://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions.git](git://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions.git)\n\n# BUGS\n\nPlease report any bugs or feature requests on the bugtracker website\n[https://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions/issues](https://github.com/robrwo/DBIx-Class-Helper-ResultSet-WindowFunctions/issues)\n\nWhen submitting a bug or request, please include a test-file or a\npatch to an existing test-file that illustrates the bug or desired\nfeature.\n\n## Reporting Security Vulnerabilities\n\nSecurity issues should not be reported on the bugtracker website. Please see `SECURITY.md` for instructions how to\nreport security vulnerabilities\n\n# AUTHOR\n\nRobert Rothenberg \u003crrwo@cpan.org\u003e\n\n# CONTRIBUTOR\n\nPeter Rabbitson \u003cribasushi@leporine.io\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is Copyright (c) 2018-2024 by Robert Rothenberg.\n\nThis is free software, licensed under:\n\n```\nThe Artistic License 2.0 (GPL Compatible)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobrwo%2Fdbix-class-helper-resultset-windowfunctions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobrwo%2Fdbix-class-helper-resultset-windowfunctions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobrwo%2Fdbix-class-helper-resultset-windowfunctions/lists"}