2
0

Support new pgtype format preferences

This commit is contained in:
Jack Christensen
2020-05-10 14:09:02 -05:00
parent aabe5538a8
commit 38dd42de4b
4 changed files with 39 additions and 30 deletions
+3 -1
View File
@@ -226,7 +226,9 @@ func encodePreparedStatementArgument(ci *pgtype.ConnInfo, buf []byte, oid uint32
// argument to a prepared statement. It defaults to TextFormatCode if no
// determination can be made.
func chooseParameterFormatCode(ci *pgtype.ConnInfo, oid uint32, arg interface{}) int16 {
switch arg.(type) {
switch arg := arg.(type) {
case pgtype.ParamFormatPreferrer:
return arg.PreferredParamFormat()
case pgtype.BinaryEncoder:
return BinaryFormatCode
case string, *string, pgtype.TextEncoder: