Code Monkey home page Code Monkey logo

pleco's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mrtnrst thekuom geun

pleco's Issues

getSortQuery in pleco-knex does not mutate query

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 })

Improve syntax ease of use

Features I would like to see

  1. Implicit eq
const filter = { field: 10};
  1. Implicit AND
const filter = { field1: 5, field2: 10 };

Improve user flow

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.

Allow skipping subquery for columns that are on the table

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'
)

Switch to CircleCI

Since this repo is still private, we only have a limited number of builds with TravisCI

Sorting breaks when not selecting an id in the query

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.