MCPcopy
hub / github.com/jmoiron/sqlx / TestNilReceiverContext

Function TestNilReceiverContext

sqlx_context_test.go:402–416  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

400}
401
402func TestNilReceiverContext(t *testing.T) {
403 RunWithSchemaContext(context.Background(), defaultSchema, t, func(ctx context.Context, db *DB, t *testing.T) {
404 loadDefaultFixtureContext(ctx, db, t)
405 var p *Person
406 err := db.GetContext(ctx, p, "SELECT * FROM person LIMIT 1")
407 if err == nil {
408 t.Error("Expected error when getting into nil struct ptr.")
409 }
410 var pp *[]Person
411 err = db.SelectContext(ctx, pp, "SELECT * FROM person")
412 if err == nil {
413 t.Error("Expected an error when selecting into nil slice ptr.")
414 }
415 })
416}
417
418func TestNamedQueryContext(t *testing.T) {
419 var schema = Schema{

Callers

nothing calls this directly

Calls 5

RunWithSchemaContextFunction · 0.85
ErrorMethod · 0.80
GetContextMethod · 0.45
SelectContextMethod · 0.45

Tested by

no test coverage detected