Skip to content

Commit

Permalink
Merge pull request #129 from stephenafamo/cols-in-insertq
Browse files Browse the repository at this point in the history
Add columns to insert query from Table model
  • Loading branch information
stephenafamo authored Nov 17, 2023
2 parents 82358b6 + 4aca2c2 commit e3353da
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dialect/mysql/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func (t *Table[T, Tslice, Tset]) uniqueSet(row Tset) ([]string, []any) {
// Starts an insert query for this table
func (t *Table[T, Tslice, Tset]) InsertQ(ctx context.Context, exec bob.Executor, queryMods ...bob.Mod[*dialect.InsertQuery]) *TQuery[*dialect.InsertQuery, T, Tslice] {
q := &TQuery[*dialect.InsertQuery, T, Tslice]{
BaseQuery: Insert(im.Into(t.NameAs(ctx))),
BaseQuery: Insert(im.Into(t.NameAs(ctx), t.View.Columns().Names()...)),
ctx: ctx,
exec: exec,
view: t.View,
Expand Down
2 changes: 1 addition & 1 deletion dialect/psql/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (t *Table[T, Tslice, Tset]) Delete(ctx context.Context, exec bob.Executor,
// Starts an insert query for this table
func (t *Table[T, Tslice, Tset]) InsertQ(ctx context.Context, exec bob.Executor, queryMods ...bob.Mod[*dialect.InsertQuery]) *TableQuery[*dialect.InsertQuery, T, Tslice] {
q := &TableQuery[*dialect.InsertQuery, T, Tslice]{
BaseQuery: Insert(im.Into(t.NameAs(ctx))),
BaseQuery: Insert(im.Into(t.NameAs(ctx), t.View.Columns().Names()...)),
ctx: ctx,
exec: exec,
view: t.View,
Expand Down
2 changes: 1 addition & 1 deletion dialect/sqlite/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (t *Table[T, Tslice, Tset]) Delete(ctx context.Context, exec bob.Executor,
// Starts an insert query for this table
func (t *Table[T, Tslice, Tset]) InsertQ(ctx context.Context, exec bob.Executor, queryMods ...bob.Mod[*dialect.InsertQuery]) *TQuery[*dialect.InsertQuery, T, Tslice] {
q := &TQuery[*dialect.InsertQuery, T, Tslice]{
BaseQuery: Insert(im.Into(t.NameAs(ctx))),
BaseQuery: Insert(im.Into(t.NameAs(ctx), t.View.Columns().Names()...)),
ctx: ctx,
exec: exec,
view: t.View,
Expand Down

0 comments on commit e3353da

Please sign in to comment.