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

Allow INSERT and UPDATE to reference columns or function results #78

Open
jaypipes opened this issue Oct 8, 2017 · 0 comments
Open
Milestone

Comments

@jaypipes
Copy link
Owner

jaypipes commented Oct 8, 2017

I'd like to allow both the sqlb.Update() and sqlb.Insert() functions to be able to reference another column or the result of a SQL function in their column value lists.

For example, let's say I want to set the created_on column to the result of the NOW() SQL function.

I'd like to be able to do:

vals := map[string]interface{}{
    "name": username,
    "created_on": sqlb.Now(),
}
q := sqlb.Insert(users, vals)
qs, qargs := q.StringArgs()

and have the qs variable contain:

INSERT INTO users (name, created_on) VALUES (?, NOW())
@jaypipes jaypipes added this to the 1.0 milestone Oct 8, 2017
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