dbf_dextractor

Crates.iodbf_dextractor
lib.rsdbf_dextractor
version0.1.2
sourcesrc
created_at2020-05-02 23:47:38.801117
updated_at2020-05-04 11:58:21.249704
descriptionExtract and deserialize dbf files
homepage
repositoryhttps://github.com/livioribeiro/dbf-dextractor
max_upload_size
id236834
size62,978
Livio Ribeiro (livioribeiro)

documentation

README

dbf-dextractor

Extract data from dbf files and deserialize with serde.

Usage

use std::collections::BTreeMap;

use serde::Deserialize;

use dbf_dextractor::{Value, Date, Timestamp};

const DBF_FILE: &str = "/path/to/data.dbf";
const DBT_FILE: &str = "/path/to/data.dbt";

#[derive(Deserialize, Debug)]
struct Record {
    boolean: bool,
    date: Date,
    timestamp: Timestamp,
    decimal: f64,
    id: u32,
    name: String,
    note: Option<String>,
}

for record in dbf_dextractor::read(DBF_FILE, Some(DBT_FILE))? {
    let record: Record = record?;
    println!("{:#?}", record);
}

let records: Vec<BTreeMap<String, Value>>
    = dbf_dextractor::read_values(DBF_FILE, Some(DBT_FILE))?
        .collect::<Result<_, _>>()?;

println!("{:#?}", records);
Commit count: 17

cargo fmt