fix: type size bit length

This commit is contained in:
Jindřich Moravec 2024-01-23 21:58:00 +01:00
parent 7773a2585e
commit 4c826923a5
2 changed files with 4 additions and 4 deletions

View file

@ -36,9 +36,9 @@ pub enum TypeConversionError {
NumberDecodeFailed(#[from] ParseFloatError),
#[error("failed to parse int from text")]
IntDecodeFailed(#[from] ParseIntError),
#[error("uknown type with oid {oid} and size {size}")]
#[error("unknown type with oid {oid} and size {size}")]
UnknownType {
oid: i32,
size: i32
size: i16
}
}

View file

@ -53,7 +53,7 @@ impl Value {
}
}
pub fn type_size(&self) -> i32 {
pub fn type_size(&self) -> i16 {
match self {
Self::Number(_) => 8,
Self::Indexable(val) => match val {
@ -75,7 +75,7 @@ impl Value {
}
}
pub fn from_text_bytes(bytes: &[u8], type_oid: i32, type_size: i32) -> Result<Value, TypeConversionError> {
pub fn from_text_bytes(bytes: &[u8], type_oid: i32, type_size: i16) -> Result<Value, TypeConversionError> {
match (type_oid, type_size) {
(701, 8) => {
let s = std::str::from_utf8(bytes)?;