MCPcopy Create free account
hub / github.com/erans/pgsqlite / convert_real_binary

Method convert_real_binary

src/protocol/value_handler.rs:272–280  ·  view source on GitHub ↗

Convert real to binary PostgreSQL format

(&self, value: f64, pg_type_oid: i32)

Source from the content-addressed store, hash-verified

270
271 /// Convert real to binary PostgreSQL format
272 fn convert_real_binary(&self, value: f64, pg_type_oid: i32) -> Vec<u8> {
273 use crate::protocol::BinaryEncoder;
274
275 match pg_type_oid {
276 t if t == PgType::Float4.to_oid() => BinaryEncoder::encode_float4(value as f32), // FLOAT4
277 t if t == PgType::Float8.to_oid() => BinaryEncoder::encode_float8(value), // FLOAT8
278 _ => value.to_string().into_bytes(), // Fallback to text
279 }
280 }
281
282 /// Convert JSON array to PostgreSQL text array format
283 fn convert_json_to_pg_array(&self, json_str: &str) -> io::Result<Vec<u8>> {

Callers 1

handle_real_valueMethod · 0.80

Calls 1

to_oidMethod · 0.80

Tested by

no test coverage detected