Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: add ability to use globally replace strings #560

Open
otan opened this issue Jan 5, 2024 · 0 comments
Open

feature request: add ability to use globally replace strings #560

otan opened this issue Jan 5, 2024 · 0 comments

Comments

@otan
Copy link

otan commented Jan 5, 2024

Apologies if this is already implemented, can't seem to find it.

Is your feature request related to a problem? Please describe.
Let's say I have a users table with fields name, email, dob.

I want to avoid using SELECT * for whatever reason, but in general I always want to select the name, email, dob column. This generally results in multiple "repeated" params, like so:

/* @name getUser */
SELECT name, email, dob FROM users WHERE name = 'xxx';

/* @name listUsers */
SELECT name, email, dob FROM users;

/* @name upsertUsers */
INSERT INTO users (...) VALUES (...) ON CONFLICT DO NOTHING RETURNING name, email, dob;

I'd prefer if I only had to define that once

Describe the solution you'd like
I'd like to able to define some sort of "global param", e.g.

/* @global user name, email, dob */

/* @name getUser */
SELECT @global:user FROM users WHERE name = 'xxx';

/* @name listUsers */
SELECT @global:user FROM users;

/* @name upsertUsers */
INSERT INTO users (...) VALUES (...) ON CONFLICT DO NOTHING RETURNING @global:user;

To avoid having to repeat this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant