Module assembly_fdb::store

source ·
Expand description

§Arena-Store & Writer

This module contains a (currently write-only) structure that represents a complete FDB file. This structure can be used to create new FDB files.

§Usage

use latin1str::Latin1String;
use assembly_fdb::{
    value::{ValueType, owned::{Field}},
    store::{Database, Table},
};

// Create a new database
let mut db = Database::new();

// Create a table
let mut table = Table::new(16);

// Add columns to the table
table.push_column(Latin1String::encode("ID"), ValueType::Integer);

// Add data to the table
table.push_row(1, &[Field::Integer(1)]);
table.push_row(2, &[Field::Integer(2)]);
table.push_row(5, &[Field::Integer(5)]);
table.push_row(6, &[Field::Integer(6)]);

// Add table to the database
db.push_table(Latin1String::encode("Table"), table);

// Write the database to a type that implements [`std::io::Write`]
let mut out: Vec<u8> = Vec::new();
db.write(&mut out).expect("success");

Structs§