| 116 | } |
| 117 | |
| 118 | func (eqb *ExtendedQueryBuilder) encodeExtendedParamValue(m *pgtype.Map, oid uint32, formatCode int16, arg any) ([]byte, error) { |
| 119 | if eqb.paramValueBytes == nil { |
| 120 | eqb.paramValueBytes = make([]byte, 0, 128) |
| 121 | } |
| 122 | |
| 123 | pos := len(eqb.paramValueBytes) |
| 124 | |
| 125 | buf, err := m.Encode(oid, formatCode, arg, eqb.paramValueBytes) |
| 126 | if err != nil { |
| 127 | return nil, err |
| 128 | } |
| 129 | if buf == nil { |
| 130 | return nil, nil |
| 131 | } |
| 132 | eqb.paramValueBytes = buf |
| 133 | return eqb.paramValueBytes[pos:], nil |
| 134 | } |
| 135 | |
| 136 | // chooseParameterFormatCode determines the correct format code for an |
| 137 | // argument to a prepared statement. It defaults to TextFormatCode if no |