Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Feature Request: Clone Method for Chains #5

dominicbarnes opened this Issue · 4 comments

2 participants


Just a small feature request for the API. I'd like a clone method that would take an existing chain and return a functional duplicate of the working SQL command.

My use-case is like this: I have a lib that's generating a SELECT statement for single items by ID, as well as the list of all in a collection. Having to specify my fields/tables/etc is kinda cumbersome and creating a wrapper function is not very elegant either.

For example:

var select =
    .from("users", "u");

var single = select.clone()
    .where("id = ?")

var list = select.clone()

This is a trivial example, but after adding joins and other conditions, this becomes a much more friendly way to approach similar queries.


This is a good idea. In the interim have you tried using normal cloning methods?


I have not yet, I'll give it a spin and report back for other's reference.

@hiddentao hiddentao referenced this issue from a commit
@hiddentao All builders now have a clone() method.
Fixed test setup error whereby tests being run multiple times.

Simplified Makefile test file spec.

refs #5

Latest version (1.0.5) now comes with a clone() method available to all query builders (but not Expression builders yet, unfortunately)


Stellar, I'll just be using that then :)


@hiddentao hiddentao closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.