dialexa / pleco Goto Github PK
View Code? Open in Web Editor NEWA collection of helpful utilities for filtering, sorting, and paginating on the database layer
License: MIT License
A collection of helpful utilities for filtering, sorting, and paginating on the database layer
License: MIT License
Something like this will not work:
const query = knex.select('model').from('vehicles');
const result = await getSortQuery({ sort, subqueries }, new KnexQB({ knex, query });
We will receive the error column "subquery.id" does not exist
When using the getSortQuery
from pleco-knex when making a call with the { mutate: true }
flag the original query is not mutated. Instead of calling
getSortQuery({ sort, subqueries }, { knex: this.knex, query, mutate: true })
to change the query, we must now do this:
query = getSortQuery({ sort, subqueries }, { knex: this.knex, query, mutate: true })
Features I would like to see
const filter = { field: 10};
const filter = { field1: 5, field2: 10 };
db-graphql-filter-knex should not just provide KnexQB. It should provide all of the exports from db-graphql-filter and call getFilterQuery, getSortQuery, etc with the specific knex implementation of IQueryBuilder instead of having the user do it. We can rename db-graphql-filter to db-graphql-filter-core perhaps.
When filtering or sorting if the table does not have a column called id
, we are unable to perform operations on it
Since this repo is still private, we only have a limited number of builds with TravisCI
The current algorithm can be improved in terms of speed. If the filter wants to just operate on a column on the table, pleco overcomplicates the SQL query. Currently, if we have a table users
with columns id
and name
and we wanted to use pleco to filter on the name, it would generate a SQL query like this:
select * from users where id in (
select resource_id from (
select id as resource_id, name as value from users
) where value = 'Bob'
)
Proposal:
If the end user passes a filter like { name: 'Bob' }
in, it should generate a simpler query like
select * from users where name = 'Bob'
or if that's not possible then something like
select * from users where id in (
select id from users where name = 'Bob'
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.