Rename CloneTypeValue to NewTypeValue

non-blocking
Jack Christensen 2020-05-12 10:26:51 -05:00
parent bff2829b0f
commit 682201a4fc
3 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ func NewArrayType(typeName string, newElement func() ValueTranscoder) *ArrayType
return &ArrayType{typeName: typeName, newElement: newElement}
}
func (at *ArrayType) CloneTypeValue() Value {
func (at *ArrayType) NewTypeValue() Value {
return &ArrayType{
elements: at.elements,
dimensions: at.dimensions,

View File

@ -31,7 +31,7 @@ func NewEnumType(typeName string, members []string) EnumType {
return et
}
func (et *enumType) CloneTypeValue() Value {
func (et *enumType) NewTypeValue() Value {
return &enumType{
value: et.value,
status: et.status,

View File

@ -134,9 +134,9 @@ type Value interface {
// In general, instances of TypeValue should not be used to directly represent a value. It should only be used as an
// encoder and decoder internal to ConnInfo.
type TypeValue interface {
// CloneTypeValue duplicates a TypeValue including references to internal type information. e.g. the list of members
// NewTypeValue creates a TypeValue including references to internal type information. e.g. the list of members
// in an EnumType.
CloneTypeValue() Value
NewTypeValue() Value
// TypeName returns the PostgreSQL name of this type.
TypeName() string
@ -359,7 +359,7 @@ func (ci *ConnInfo) InitializeDataTypes(nameOIDs map[string]uint32) {
func (ci *ConnInfo) RegisterDataType(t DataType) {
if tv, ok := t.Value.(TypeValue); ok {
t.Value = tv.CloneTypeValue()
t.Value = tv.NewTypeValue()
}
ci.oidToDataType[t.OID] = &t
@ -469,7 +469,7 @@ func (ci *ConnInfo) DeepCopy() *ConnInfo {
for _, dt := range ci.oidToDataType {
var value Value
if tv, ok := dt.Value.(TypeValue); ok {
value = tv.CloneTypeValue()
value = tv.NewTypeValue()
} else {
value = reflect.New(reflect.ValueOf(dt.Value).Elem().Type()).Interface().(Value)
}