@@ -5,35 +5,35 @@ import "testing"
55func TestInsert (t * testing.T ) {
66 runTests (t , func (dbz * DB ) []test {
77 return []test {
8- test {
8+ {
99 "simple insert" ,
1010 dbz .InsertInto ("table" ).Columns ("id" , "name" , "date" ).Values (1 , "My Name" , 96969696 ),
1111 "INSERT INTO table (id, name, date) VALUES (?, ?, ?)" ,
1212 []interface {}{1 , "My Name" , 96969696 },
1313 },
1414
15- test {
15+ {
1616 "insert with value map" ,
1717 dbz .InsertInto ("table" ).ValueMap (map [string ]interface {}{"id" : 1 , "name" : "My Name" }),
1818 "INSERT INTO table (id, name) VALUES (?, ?)" ,
1919 []interface {}{1 , "My Name" },
2020 },
2121
22- test {
22+ {
2323 "insert with returning clause" ,
2424 dbz .InsertInto ("table" ).Columns ("one" , "two" ).Values (1 , 2 ).Returning ("id" ),
2525 "INSERT INTO table (one, two) VALUES (?, ?) RETURNING id" ,
2626 []interface {}{1 , 2 },
2727 },
2828
29- test {
29+ {
3030 "insert with on conflict do nothing clause" ,
3131 dbz .InsertInto ("table" ).Columns ("one" , "two" ).Values (1 , 2 ).OnConflictDoNothing (),
3232 "INSERT INTO table (one, two) VALUES (?, ?) ON CONFLICT DO NOTHING" ,
3333 []interface {}{1 , 2 },
3434 },
3535
36- test {
36+ {
3737 "insert rows from a select query" ,
3838 dbz .InsertInto ("table" ).Columns ("one" , "two" ).FromSelect (
3939 dbz .Select ("*" ).From ("table2" ),
@@ -42,7 +42,7 @@ func TestInsert(t *testing.T) {
4242 []interface {}{},
4343 },
4444
45- test {
45+ {
4646 "insert with on conflict do update" ,
4747 dbz .InsertInto ("table" ).Columns ("name" ).Values ("My Name" ).
4848 OnConflict (
@@ -57,7 +57,7 @@ func TestInsert(t *testing.T) {
5757 []interface {}{"My Name" , 55151515 , "Some Address" , "My Name Again" },
5858 },
5959
60- test {
60+ {
6161 "insert with on conflict do update conditional set" ,
6262 dbz .InsertInto ("table" ).Columns ("name" ).Values ("My Name" ).
6363 OnConflict (
@@ -71,20 +71,20 @@ func TestInsert(t *testing.T) {
7171 []interface {}{"My Name" , 55151515 , 1 },
7272 },
7373
74- test {
74+ {
7575 "insert or ignore" ,
7676 dbz .InsertInto ("table" ).OrIgnore ().Columns ("id" , "name" , "date" ).Values (1 , "My Name" , 96969696 ),
7777 "INSERT OR IGNORE INTO table (id, name, date) VALUES (?, ?, ?)" ,
7878 []interface {}{1 , "My Name" , 96969696 },
7979 },
80- test {
80+ {
8181 "insert or replace" ,
8282 dbz .InsertInto ("table" ).OrReplace ().Columns ("id" , "name" , "date" ).Values (1 , "My Name" , 96969696 ),
8383 "INSERT OR REPLACE INTO table (id, name, date) VALUES (?, ?, ?)" ,
8484 []interface {}{1 , "My Name" , 96969696 },
8585 },
8686
87- test {
87+ {
8888 "insert with multiple values" ,
8989 dbz .InsertInto ("table" ).Columns ("id" , "name" ).
9090 ValueMultiple ([][]interface {}{{1 , "My Name" }, {2 , "John" }, {3 , "Golang" }}),
0 commit comments