Skip to main content

Crate realm_codec

Crate realm_codec 

Source
Expand description

§realm-codec

Parser and writer for Realm binary database files (format version 9).

§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§

RealmFile
An opened and fully-parsed Realm database file.
RealmTable
A parsed Realm table: schema + rows.
Row
A single row of cell values in a table.

Enums§

ColumnType
The declared type of a Realm column.
RealmError
Errors that can occur while opening or parsing a Realm file.
Value
A single parsed cell value.

Type Aliases§

Result
Convenience Result alias for this crate.