2
0

Move chooseParameterFormatCode

This commit is contained in:
Jack Christensen
2022-03-05 15:16:12 -06:00
parent 0d8e109c21
commit 39d2e3dc3f
2 changed files with 13 additions and 13 deletions
-12
View File
@@ -143,18 +143,6 @@ func encodePreparedStatementArgument(m *pgtype.Map, buf []byte, oid uint32, arg
return nil, SerializationError(fmt.Sprintf("Cannot encode %T into oid %v - %T must implement Encoder or be converted to a string", arg, oid, arg))
}
// chooseParameterFormatCode determines the correct format code for an
// argument to a prepared statement. It defaults to TextFormatCode if no
// determination can be made.
func chooseParameterFormatCode(m *pgtype.Map, oid uint32, arg interface{}) int16 {
switch arg.(type) {
case string, *string:
return TextFormatCode
}
return m.FormatCodeForOID(oid)
}
func stripNamedType(val *reflect.Value) (interface{}, bool) {
switch val.Kind() {
case reflect.Int: