MCPcopy
hub / github.com/jackc/pgx / encodeExtendedParamValue

Method encodeExtendedParamValue

extended_query_builder.go:118–134  ·  view source on GitHub ↗
(m *pgtype.Map, oid uint32, formatCode int16, arg any)

Source from the content-addressed store, hash-verified

116}
117
118func (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

Callers 1

appendParamMethod · 0.95

Calls 1

EncodeMethod · 0.65

Tested by

no test coverage detected