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

Function TestSelectSliceMapTimeContext

sqlx_context_test.go:373–400  ·  sqlx_context_test.go::TestSelectSliceMapTimeContext
(t *testing.T)

Source from the content-addressed store, hash-verified

371}
372
373func TestSelectSliceMapTimeContext(t *testing.T) {
374 RunWithSchemaContext(context.Background(), defaultSchema, t, func(ctx context.Context, db *DB, t *testing.T) {
375 loadDefaultFixtureContext(ctx, db, t)
376 rows, err := db.QueryxContext(ctx, "SELECT * FROM person")
377 if err != nil {
378 t.Fatal(err)
379 }
380 for rows.Next() {
381 _, err := rows.SliceScan()
382 if err != nil {
383 t.Error(err)
384 }
385 }
386
387 rows, err = db.QueryxContext(ctx, "SELECT * FROM person")
388 if err != nil {
389 t.Fatal(err)
390 }
391 for rows.Next() {
392 m := map[string]interface{}{}
393 err := rows.MapScan(m)
394 if err != nil {
395 t.Error(err)
396 }
397 }
398
399 })
400}
401
402func TestNilReceiverContext(t *testing.T) {
403 RunWithSchemaContext(context.Background(), defaultSchema, t, func(ctx context.Context, db *DB, t *testing.T) {

Callers

nothing calls this directly

Calls 7

RunWithSchemaContextFunction · 0.85
NextMethod · 0.80
ErrorMethod · 0.80
QueryxContextMethod · 0.65
SliceScanMethod · 0.45
MapScanMethod · 0.45

Tested by

no test coverage detected