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

Function TestSelectBuilderPlaceholders

select_test.go:99–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

97}
98
99func TestSelectBuilderPlaceholders(t *testing.T) {
100 b := Select("test").Where("x = ? AND y = ?")
101
102 sql, _, _ := b.PlaceholderFormat(Question).ToSql()
103 assert.Equal(t, "SELECT test WHERE x = ? AND y = ?", sql)
104
105 sql, _, _ = b.PlaceholderFormat(Dollar).ToSql()
106 assert.Equal(t, "SELECT test WHERE x = $1 AND y = $2", sql)
107
108 sql, _, _ = b.PlaceholderFormat(Colon).ToSql()
109 assert.Equal(t, "SELECT test WHERE x = :1 AND y = :2", sql)
110
111 sql, _, _ = b.PlaceholderFormat(AtP).ToSql()
112 assert.Equal(t, "SELECT test WHERE x = @p1 AND y = @p2", sql)
113}
114
115func TestSelectBuilderRunners(t *testing.T) {
116 db := &DBStub{}

Callers

nothing calls this directly

Calls 4

SelectFunction · 0.85
ToSqlMethod · 0.65
WhereMethod · 0.45
PlaceholderFormatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…