MCPcopy
hub / github.com/go-sql-driver/mysql / TestRawMessage

Function TestRawMessage

driver_test.go:695–716  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

693}
694
695func TestRawMessage(t *testing.T) {
696 runTestsParallel(t, dsn, func(dbt *DBTest, _ string) {
697 v1 := json.RawMessage("{}")
698 v2 := json.RawMessage("[]")
699 rows := dbt.mustQuery("SELECT ?, ?", v1, v2)
700 defer rows.Close()
701 if rows.Next() {
702 var o1, o2 json.RawMessage
703 if err := rows.Scan(&o1, &o2); err != nil {
704 dbt.Errorf("Got error: %v", err)
705 }
706 if !bytes.Equal(v1, o1) {
707 dbt.Errorf("expected %v, got %v", v1, o1)
708 }
709 if !bytes.Equal(v2, o2) {
710 dbt.Errorf("expected %v, got %v", v2, o2)
711 }
712 } else {
713 dbt.Errorf("no data")
714 }
715 })
716}
717
718type testValuer struct {
719 value string

Callers

nothing calls this directly

Calls 5

runTestsParallelFunction · 0.85
mustQueryMethod · 0.80
ScanMethod · 0.80
CloseMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected