MCPcopy
hub / github.com/Masterminds/squirrel / TestInsertBuilderSetMap

Function TestInsertBuilderSetMap

insert_test.go:76–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestInsertBuilderSetMap(t *testing.T) {
77 b := Insert("table").SetMap(Eq{"field1": 1, "field2": 2, "field3": 3})
78
79 sql, args, err := b.ToSql()
80 assert.NoError(t, err)
81
82 expectedSQL := "INSERT INTO table (field1,field2,field3) VALUES (?,?,?)"
83 assert.Equal(t, expectedSQL, sql)
84
85 expectedArgs := []interface{}{1, 2, 3}
86 assert.Equal(t, expectedArgs, args)
87}
88
89func TestInsertBuilderSelect(t *testing.T) {
90 sb := Select("field1").From("table1").Where(Eq{"field1": 1})

Callers

nothing calls this directly

Calls 3

InsertFunction · 0.85
ToSqlMethod · 0.65
SetMapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…