MCPcopy Create free account
hub / github.com/apecloud/myduckserver / NormalizeRow

Function NormalizeRow

pgtest/framework.go:86–102  ·  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

84// NormalizeRow normalizes each value's type, as the tests only want to compare values.
85// Returns a new row.
86func NormalizeRow(fds []pgconn.FieldDescription, row sql.Row, normalize bool) sql.Row {
87 if len(row) == 0 {
88 return nil
89 }
90 newRow := make(sql.Row, len(row))
91 for i := range row {
92 typ, ok := defaultMap.TypeForOID(fds[i].DataTypeOID)
93 if !ok {
94 panic(fmt.Sprintf("unknown oid: %v", fds[i].DataTypeOID))
95 }
96 newRow[i] = NormalizeValToString(typ, row[i])
97 if normalize {
98 newRow[i] = NormalizeIntsAndFloats(newRow[i])
99 }
100 }
101 return newRow
102}
103
104// NormalizeExpectedRow normalizes each value's type, as the tests only want to compare values. Returns a new row.
105func NormalizeExpectedRow(fds []pgconn.FieldDescription, rows []sql.Row) []sql.Row {

Callers 1

NormalizeRowsFunction · 0.85

Calls 2

NormalizeValToStringFunction · 0.85
NormalizeIntsAndFloatsFunction · 0.85

Tested by

no test coverage detected