Expand description
§realm-codec
Parser and writer for Realm binary database files (format version 9).
- Read an existing
.realmfile withRealmFile::open— no Realm SDK required. - Write a new
.realmfile from scratch withRealmBuilder.
§Reading
use realm_codec::{RealmFile, Value};
let realm = RealmFile::open("/path/to/file.realm")?;
if let Some(table) = realm.table("class_BlockDataModel") {
for row in &table.rows {
println!("{}", table.get(row, "content").as_str());
}
}§Writing
use realm_codec::{RealmBuilder, ColumnType, Value};
let mut builder = RealmBuilder::new();
builder
.table("class_Note")
.column("id", ColumnType::String)
.column("body", ColumnType::String)
.row(vec![Value::String("1".into()), Value::String("Hello".into())]);
builder.write("/path/to/out.realm")?;Re-exports§
pub use write::RealmBuilder;pub use write::TableBuilder;
Modules§
- write
- Write support: build Realm v9 binary files from scratch.
Structs§
- Realm
File - An opened and fully-parsed Realm database file.
- Realm
Table - A parsed Realm table: schema + rows.
- Row
- A single row of cell values in a table.
Enums§
- Column
Type - The declared type of a Realm column.
- Realm
Error - Errors that can occur while opening or parsing a Realm file.
- Value
- A single parsed cell value.
Type Aliases§
- Result
- Convenience
Resultalias for this crate.