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

Adjustable Queries #57

Open
lippserd opened this issue Aug 6, 2024 · 0 comments · May be fixed by #17
Open

Adjustable Queries #57

lippserd opened this issue Aug 6, 2024 · 0 comments · May be fixed by #17
Labels
enhancement New feature or request
Milestone

Comments

@lippserd
Copy link
Member

lippserd commented Aug 6, 2024

Requirements

  • Not all columns may be used in queries.
  • WHERE clause used in statements must be adjustable. Default for DELETE for example is id IN (?) at the moment.
  • Executed query should be replaceable, e.g. ON DUPLICATE KEY may specify col = col + VALUES(col).
  • All functionality shall be usable w/o building custom types, e.g. table name, columns as string, []string.

Possible API

// Using query builder directly
sql := NewQueryBuilder(db, subject).SetColumns(columns).Insert()
db.NamedBulkExec(ctx, sql, ch)

// Functional options
db.Upsert(ctx, ch, options.SetColumns(columns))

// Using query builder directly #2
upsert := qb.Upsert(subject).Columns(columns)
db.NamedBulkExec(ctx, upsert, ch)
// or
upsert.Stream(ctx, db, ch)

db.Upsert().Columns(columns).Exec() // .Stream()

qb.Upsert().Columns().Exec(ctx, db, setofData) // .Stream(ctx, db, ch)
@lippserd lippserd added the enhancement New feature or request label Aug 6, 2024
@lippserd lippserd added this to the 0.4.0 milestone Aug 6, 2024
@yhabteab yhabteab self-assigned this Aug 8, 2024
@lippserd lippserd assigned oxzi and unassigned oxzi and yhabteab Aug 14, 2024
@yhabteab yhabteab linked a pull request Nov 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants