(m *pgtype.Map, buf []byte, oid uint32, arg any)
| 44 | } |
| 45 | |
| 46 | func tryScanStringCopyValueThenEncode(m *pgtype.Map, buf []byte, oid uint32, arg any) ([]byte, error) { |
| 47 | s, ok := arg.(string) |
| 48 | if !ok { |
| 49 | textBuf, err := m.Encode(oid, TextFormatCode, arg, nil) |
| 50 | if err != nil { |
| 51 | return nil, errors.New("not a string and cannot be encoded as text") |
| 52 | } |
| 53 | s = string(textBuf) |
| 54 | } |
| 55 | |
| 56 | var v any |
| 57 | err := m.Scan(oid, TextFormatCode, []byte(s), &v) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | |
| 62 | return m.Encode(oid, BinaryFormatCode, v, buf) |
| 63 | } |
no test coverage detected