goqu
goqu copied to clipboard
feat: allow conflict targets in ON CONFLICT DO NOTHING
I have added the ability to specify conflict target columns for the ON CONFLICT
clause, which is necessary for PostgreSQL.
Now it is possible to handle conflicts by specifying columns for conflict handling:
sql, _, _ := goqu.Insert("test").
Rows(goqu.Record{"a": "a", "b"}).
OnConflict(goqu.DoNothing().SetCols(exp.NewColumnListExpression("a", "b"))).
ToSQL()
fmt.Println(sql)
Then you will get:
INSERT INTO "test" ("a", "b") VALUES ('a', 'b') ON CONFLICT ("a", "b") DO NOTHING