fn from_sql_to_rust_type(&self, dtype: &PgType, row: &Row, index: usize) -> Option<Value> {
        match *dtype {
            PgType::Uuid => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::Uuid(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Varchar | PgType::Text | PgType::Bpchar => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::String(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::TimestampTZ | PgType::Timestamp => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::DateTime(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Float4 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::F32(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Float8 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::F64(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Numeric => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::F64(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            } 
            PgType::Bool => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::Bool(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Json => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::Json(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Int2 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::I16(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Int4 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::I32(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Int8 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::I64(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Timetz => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::DateTime(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Date => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::DateTime(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Bytea => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::VecU8(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Inet => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::String(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Tsvector => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::String(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            _ => panic!("Type {:?} is not covered!", dtype),
        }
    }
/// convert a record of a row into rust type
convert a record of a row into rust type
convert a record of a row into rust type
fn from_sql_to_rust_type(&self, dtype: &PgType, row: &Row, index: usize) -> Option<Value> {
        match *dtype {
            PgType::Uuid => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::Uuid(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Varchar | PgType::Text | PgType::Bpchar => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::String(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::TimestampTZ | PgType::Timestamp => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::DateTime(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Float4 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::F32(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Float8 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::F64(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Numeric => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::F64(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            } 
            PgType::Bool => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::Bool(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Json => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::Json(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Int2 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::I16(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Int4 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::I32(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Int8 => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::I64(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Timetz => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::DateTime(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Date => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::DateTime(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Bytea => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::VecU8(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Inet => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::String(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            PgType::Tsvector => {
                let value = row.get_opt(index);
                match value {
                    Some(value) => {
                        match value {
                            Ok(value) => Some(Value::String(value)),
                            Err(_) => None,
                        }
                    }
                    None => None,
                }
            }
            _ => panic!("Type {:?} is not covered!", dtype),
        }
    }
fn from_sql_to_rust_type ( & self , dtype : & PgType , row : & Row , index : usize ) -> Option < Value > { match * dtype { PgType :: Uuid => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: Uuid ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Varchar | PgType :: Text | PgType :: Bpchar => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: String ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: TimestampTZ | PgType :: Timestamp => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: DateTime ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Float4 => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: F32 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Float8 => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: F64 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Numeric => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: F64 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Bool => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: Bool ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Json => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: Json ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Int2 => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: I16 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Int4 => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: I32 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Int8 => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: I64 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Timetz => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: DateTime ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Date => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: DateTime ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Bytea => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: VecU8 ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Inet => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: String ( value ) ) , Err ( _ ) => None , } } None => None , } } PgType :: Tsvector => { let value = row . get_opt ( index ) ; match value { Some ( value ) => { match value { Ok ( value ) => Some ( Value :: String ( value ) ) , Err ( _ ) => None , } } None => None , } } _ => panic ! ( " " dtype ) , } }
convert a record of a row into rust type
convert a record of a row into rust type
&self
dtype
&PgType
row
&Row
index
usize
&self
dtype
&PgType
row
&Row
index
usize