Crate structsy

source ·
Expand description

Simple single file struct persistence manger

Example

use structsy::{Structsy, StructsyError, StructsyTx};
use structsy_derive::Persistent;
#[derive(Persistent)]
struct MyData {
    name: String,
    address: String,
}
// ......
let db = Structsy::open("my_data.db")?;
db.define::<MyData>()?;

 let my_data = MyData {
   name: "Structsy".to_string(),
   address: "https://gitlab.com/tglman/structsy".to_string(),
};
let mut tx = db.begin()?;
tx.insert(&my_data)?;
tx.commit()?;

Re-exports

Modules

  • Re Export proc macros
  • Internal APIs used by the generated code to interact with structsy, not for public use
  • Raw access structures

Structs

  • Generic filter for any Persistent structures
  • Owned transation to use with StructsyTx trait
  • Prepare open of a structsy file, with migrations possibilities
  • Transaction prepared state ready to be committed if the second phase is considered successful
  • Iterator of raw Records
  • Prepared state of RawTransaction
  • Transaction for save data in a structsy database without the original source code
  • Reference to a record, can be used to load a record or to refer a record from another one.
  • Reference transaction to use with StructsyTx trait
  • Read data from a snapshot freezed in a specific moment ignoring all the subsequent committed transactions.
  • A query to be executed on a specific snapshot
  • Main API to persist structs with structsy.
  • Configuration builder for open/create a Structsy file.
  • Iterator for query results
  • Query for a persistent struct
  • Query for a persistent struct considering in transaction changes.

Enums

  • Query ordering
  • All the possible Structsy errors
  • Define the behavior of the index in case a key value pair already exists

Traits

Type Definitions