You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Think of this as an extension of [Squirrel](https://github.com/Masterminds/squirrel) with functionability like [Knex](https://knexjs.org/). I still use Squirrel for other types of queries (insert, select, and all that), but I needed some SQL builder for create table and some other stuffs.
5
+
Think of this as an extension of [Squirrel](https://github.com/Masterminds/squirrel) with functionability like [Knex](https://knexjs.org/). I still use Squirrel for other types of queries (insert, select, and all that), but I needed some SQL builder for create table and some other stuffs. Including database creation & upsert.
6
6
7
7
Oh, and of course, heavily inspired by [Bob the Builder](https://en.wikipedia.org/wiki/Bob_the_Builder).
8
8
@@ -116,6 +116,44 @@ func main() {
116
116
}
117
117
```
118
118
119
+
### Upsert
120
+
121
+
```go
122
+
funcmain() {
123
+
sql, args, err:= bob.
124
+
// Notice that you should give database dialect on the second params.
125
+
// Available database dialect are MySQL, PostgreSQL, SQLite, and MSSQL.
126
+
Upsert("users", bob.MySQL).
127
+
Columns("name", "email", "age").
128
+
// You could do multiple Values() call, but I'd suggest to not do it.
129
+
// Because this is an upsert function, not an insert one.
0 commit comments