2
0

Remove some now unused pgtype code

Most of this is in conversion, and I assume it became unused with some
of the v5 changes and refactors to a codec-based approach.

There are likely a few more cleanups to be made, but these ones seemed
easy and safe to start with.
This commit is contained in:
Dan McGee
2023-07-10 08:58:12 -05:00
committed by Jack Christensen
parent 0328d314ea
commit 507a9e9ad3
6 changed files with 2 additions and 440 deletions
-22
View File
@@ -5,7 +5,6 @@ import (
"encoding/binary"
"fmt"
"io"
"reflect"
"strconv"
"strings"
"unicode"
@@ -375,27 +374,6 @@ func quoteArrayElementIfNeeded(src string) string {
return src
}
func findDimensionsFromValue(value reflect.Value, dimensions []ArrayDimension, elementsLength int) ([]ArrayDimension, int, bool) {
switch value.Kind() {
case reflect.Array:
fallthrough
case reflect.Slice:
length := value.Len()
if 0 == elementsLength {
elementsLength = length
} else {
elementsLength *= length
}
dimensions = append(dimensions, ArrayDimension{Length: int32(length), LowerBound: 1})
for i := 0; i < length; i++ {
if d, l, ok := findDimensionsFromValue(value.Index(i), dimensions, elementsLength); ok {
return d, l, true
}
}
}
return dimensions, elementsLength, true
}
// Array represents a PostgreSQL array for T. It implements the ArrayGetter and ArraySetter interfaces. It preserves
// PostgreSQL dimensions and custom lower bounds. Use FlatArray if these are not needed.
type Array[T any] struct {