{"id":17159154,"url":"https://github.com/scull7/filter-sort-paginate","last_synced_at":"2025-07-04T22:32:22.298Z","repository":{"id":20234525,"uuid":"23506504","full_name":"scull7/filter-sort-paginate","owner":"scull7","description":"This is a simple filter sort paginate module designed to work with expressJS like ","archived":false,"fork":false,"pushed_at":"2014-09-15T17:43:15.000Z","size":336,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-24T09:48:50.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scull7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-31T04:34:10.000Z","updated_at":"2014-09-13T22:04:28.000Z","dependencies_parsed_at":"2022-07-22T10:32:13.670Z","dependency_job_id":null,"html_url":"https://github.com/scull7/filter-sort-paginate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/scull7/filter-sort-paginate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Ffilter-sort-paginate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Ffilter-sort-paginate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Ffilter-sort-paginate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Ffilter-sort-paginate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scull7","download_url":"https://codeload.github.com/scull7/filter-sort-paginate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Ffilter-sort-paginate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263628007,"owners_count":23490893,"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-10-14T22:13:29.380Z","updated_at":"2025-07-04T22:32:22.268Z","avatar_url":"https://github.com/scull7.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/scull7/filter-sort-paginate.svg?branch=master)](https://travis-ci.org/scull7/filter-sort-paginate)\n[![Coverage Status](https://img.shields.io/coveralls/scull7/filter-sort-paginate.svg)](https://coveralls.io/r/scull7/filter-sort-paginate)\n[![Code Climate](https://codeclimate.com/github/scull7/filter-sort-paginate/badges/gpa.svg)](https://codeclimate.com/github/scull7/filter-sort-paginate)\n\nfilter-sort-paginate\n====================\n\nThis is a simple filter sort paginate module designed to work \nwith expressJS like frameworks.\n\nusage\n-----\n\n```javascript\n\nvar fsp     = require('filter-sort-paginate'),\n    express = require('express'),\n    mysql   = require('mysql'),\n    app     = express()\n;\n\napp.use(function (req, res, next) {\n  req.mysql = ... //get mysql connection\n});\n\napp.get('/', fsp('table_name'))\n\n```\n\nThe response will be an object that has the following structure:\n\n```javascript\n{\n  items: [ { name: 'value' }, ... ],\n  total: 10, // total number of items produced by the query.\n  field_data: [ { /* column data from mysql */ ... ],\n  repository: 'table_name', // name of the current table.\n  fields: [ /* any currently specified fields */ ],\n  sorts: [ /* any currently specified sort fields */ ],\n  filters: [ /* any currently specified filters */ ],\n  limit: 100, // 100 is the default limit\n  page: 1, // page is one based\n}\n```\n\nGiven the following request URL\n\n`/?filter=test:is:something|this:gt:that\u0026sort=+test|-that\u0026page=2\u0026limit=25`\n\nWith the following set up.\n\n```javascript\n  app.get('/', fsp('table_name', [ 'test', { column: 'this', alias: 'me' }, 'that' ]));\n```\n\nThe following response will be generated\n\n```javascript\n{\n  items: [ { test: 'something', this: 'then', that: 'this' }, ... ],\n  total: 10, // total number of items produced by the query.\n  field_data: [ { /* column data from mysql */ ...} ],\n  repository: 'table_name', // name of the current table.\n  fields: [\n    { column: 'test', alias: null },\n    { column: 'this', alias: 'me' },\n    { column: 'that', alias: null }\n  ],\n  sorts: [\n    { column: 'test', direction: '+' },\n    { column: 'that', direction: '-' }\n  ],\n  filters: [\n    { column: 'test', action: 'is', value: 'something' },\n    { column: 'this', action: 'gt', value: 'that' }\n  ],\n  limit: 25, // 100 is the default limit\n  page: 2, // page is one based\n}\n```\n\nTo Do\n-----\n\n* Fix exceptions in MySQL driver not being caught.\n* Add concept of defaults to the options array.  \n  These will be default filters, sorts, etc...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscull7%2Ffilter-sort-paginate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscull7%2Ffilter-sort-paginate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscull7%2Ffilter-sort-paginate/lists"}