Skip to content

Commit

Permalink
🐛 fix(sqlite.go): add dialect to goqu queries to ensure compatibility…
Browse files Browse the repository at this point in the history
… with specific database dialect
  • Loading branch information
thalesfsp committed Jul 7, 2023
1 parent 4412dfb commit d93a711
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (p *SQLite) Delete(ctx context.Context, id, target string, prm *delete.Dele
}
}

ds := goqu.Delete(trgt).Where(goqu.C("id").Eq(id))
ds := goqu.Dialect(Name).Delete(trgt).Where(goqu.C("id").Eq(id))

// Convert the query to SQL, and arguments.
selectSQL, args, err := ds.ToSQL()
Expand Down Expand Up @@ -425,7 +425,7 @@ func (p *SQLite) Retrieve(ctx context.Context, id, target string, v any, prm *re
}

// Build the statement.
ds := goqu.From(trgt).Where(goqu.C("id").Eq(id))
ds := goqu.Dialect(Name).From(trgt).Where(goqu.C("id").Eq(id))

// Convert the query to SQL, and arguments.
selectSQL, args, err := ds.ToSQL()
Expand Down Expand Up @@ -658,7 +658,7 @@ func (p *SQLite) Create(ctx context.Context, id, target string, v any, prm *crea
}

// Build the statement.
ds := goqu.
ds := goqu.Dialect(Name).
Insert(trgt).
Rows(v).
Returning("id")
Expand Down Expand Up @@ -783,7 +783,7 @@ func (p *SQLite) Update(ctx context.Context, id, target string, v any, prm *upda
}

// Build the statement.
ds := goqu.Update(trgt).Set(v).Where(goqu.C("id").Eq(id))
ds := goqu.Dialect(Name).Update(trgt).Set(v).Where(goqu.C("id").Eq(id))

// Convert the query to SQL, and arguments.
updateSQL, args, err := ds.ToSQL()
Expand Down

0 comments on commit d93a711

Please sign in to comment.