MCPcopy Index your code
hub / github.com/Masterminds/squirrel / TestNullTypeInt64

Function TestNullTypeInt64

expr_test.go:209–226  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

207}
208
209func TestNullTypeInt64(t *testing.T) {
210 var userID sql.NullInt64
211 userID.Scan(nil)
212 b := Eq{"user_id": userID}
213 sql, args, err := b.ToSql()
214
215 assert.NoError(t, err)
216 assert.Empty(t, args)
217 assert.Equal(t, "user_id IS NULL", sql)
218
219 userID.Scan(int64(10))
220 b = Eq{"user_id": userID}
221 sql, args, err = b.ToSql()
222
223 assert.NoError(t, err)
224 assert.Equal(t, []interface{}{int64(10)}, args)
225 assert.Equal(t, "user_id = ?", sql)
226}
227
228func TestNilPointer(t *testing.T) {
229 var name *string = nil

Callers

nothing calls this directly

Calls 2

ToSqlMethod · 0.95
ScanMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…