MCPcopy
hub / github.com/jackc/pgx / TestConnQueryScanRange

Function TestConnQueryScanRange

stdlib/sql_test.go:520–540  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

518}
519
520func TestConnQueryScanRange(t *testing.T) {
521 testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {
522 skipCockroachDB(t, db, "Server does not support int4range")
523
524 m := pgtype.NewMap()
525
526 var r pgtype.Range[pgtype.Int4]
527 err := db.QueryRow("select int4range(1, 5)").Scan(m.SQLScanner(&r))
528 require.NoError(t, err)
529 assert.Equal(
530 t,
531 pgtype.Range[pgtype.Int4]{
532 Lower: pgtype.Int4{Int32: 1, Valid: true},
533 Upper: pgtype.Int4{Int32: 5, Valid: true},
534 LowerType: pgtype.Inclusive,
535 UpperType: pgtype.Exclusive,
536 Valid: true,
537 },
538 r)
539 })
540}
541
542// Test type that pgx would handle natively in binary, but since it is not a
543// database/sql native type should be passed through as a string

Callers

nothing calls this directly

Calls 6

SQLScannerMethod · 0.95
NewMapFunction · 0.92
skipCockroachDBFunction · 0.70
ScanMethod · 0.65
QueryRowMethod · 0.65

Tested by

no test coverage detected