question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: clear

See original GitHub issue

It would be nice to clear the part of previous node. In knex, there is a clear method.

const query = knex("Table").select("a","b") // SELECT a, b FROM Table
query.clear("select")
query.select("a") // SELECT a FROM Table

This is a useful feature for reusing parts of queries.

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
koskimascommented, Dec 14, 2022

That’s a good example. We need separate clearSelect(), clearLimit() etc. methods instead of a clear(what) method. For example clearSelect() will change the query builder type. Some clear methods like clearJoin() shouldn’t be implemented because of what it would do to the types. Removing a join and keeping a selection from that table will mess up the types (and the query too).

0reactions
thelinuxlichcommented, Dec 15, 2022

I was thinking of something like

import { ExpressionBuilder, SelectExpression, sql } from "kysely";
export default <DB, TB extends keyof DB, S extends SelectExpression<DB, TB>>(
	eb: ExpressionBuilder<DB, TB>,
        field: S, 
        sortField: S,
        sortDirection = "asc",
        limit = 10,
        offset = 1,
) => {
	return eb.select(qb => qb.fn.count<number>(field).as("count")).limit(limit).offset(offset).orderBy(sortField, sortDirection)
};

// usage
query.call(qb => countHelper(qb, "id", "created_at"))
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to say no to product feature requests - Canny Blog
Here's how to say no to feature requests the right way. ... say no to product feature requests. Many companies make it clear...
Read more >
Feature Request: Clear All in Search - Roon Labs Community
Search results remain and the search list grows longer with each query. Other apps, BluOS for example have a Clear All button that...
Read more >
Feature Request: Clear all alerts from Sites Overview
Occasionally, connectivity interruptions may generate numerous alerts across numerous sites and being able to clear them all conveniently (from the GUI) ...
Read more >
Feature Requests: How to Write, Manage and Prioritize them?
Feature requests are best when they're brief, clear, and to the point. Think of it like a short email message: even if you're...
Read more >
Feature Request Template: How to Manage Suggestions at ...
In this post, you'll get to download a feature request template ... A good feature request is clear and easy to manage and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found