NormalizeArrayType normalizes array types by normalizing its elements first, then to a string using the type IoOutput method.
(dta *pgtype.Type, arr []any)
| 242 | // NormalizeArrayType normalizes array types by normalizing its elements first, |
| 243 | // then to a string using the type IoOutput method. |
| 244 | func NormalizeArrayType(dta *pgtype.Type, arr []any) any { |
| 245 | baseType := dta.Codec.(*pgtype.ArrayCodec).ElementType |
| 246 | newVal := make([]any, len(arr)) |
| 247 | for i, el := range arr { |
| 248 | newVal[i] = NormalizeVal(baseType, el) |
| 249 | } |
| 250 | bytes, err := defaultMap.Encode(dta.OID, pgtype.TextFormatCode, newVal, nil) |
| 251 | if err != nil { |
| 252 | panic(err) |
| 253 | } |
| 254 | return string(bytes) |
| 255 | } |
| 256 | |
| 257 | // NormalizeVal normalizes values to the Doltgres type expects, so it can be used to |
| 258 | // convert the values using the given Doltgres type. This is used to normalize array |
no test coverage detected