MCPcopy Create free account
hub / github.com/dolthub/doltgresql / NormalizeRow

Function NormalizeRow

testing/go/framework.go:547–564  ·  view source on GitHub ↗

NormalizeRow normalizes each value's type, as the tests only want to compare values. Returns a new row.

(fds []pgconn.FieldDescription, row sql.Row, normalize bool)

Source from the content-addressed store, hash-verified

545// NormalizeRow normalizes each value's type, as the tests only want to compare values.
546// Returns a new row.
547func NormalizeRow(fds []pgconn.FieldDescription, row sql.Row, normalize bool) sql.Row {
548 if len(row) == 0 {
549 return nil
550 }
551 newRow := make(sql.Row, len(row))
552 for i := range row {
553 dt, ok := types.IDToBuiltInDoltgresType[id.Type(id.Cache().ToInternal(fds[i].DataTypeOID))]
554 if !ok {
555 // try using text type
556 dt = types.Text
557 }
558 newRow[i] = NormalizeValToString(dt, row[i])
559 if normalize {
560 newRow[i] = NormalizeIntsAndFloats(newRow[i])
561 }
562 }
563 return newRow
564}
565
566// NormalizeExpectedRow normalizes each value's type, as the tests only want to compare values. Returns a new row.
567func NormalizeExpectedRow(fds []pgconn.FieldDescription, rows []sql.Row) []sql.Row {

Callers 1

NormalizeRowsFunction · 0.85

Calls 5

TypeTypeAlias · 0.92
CacheFunction · 0.92
NormalizeValToStringFunction · 0.85
NormalizeIntsAndFloatsFunction · 0.85
ToInternalMethod · 0.80

Tested by

no test coverage detected