Where it lands
Unified Field apps compile Valence schemas into Model APIs and bind them through Valence::builder() so counters, identity, and product tables share one transparency layer across backends.Define schemas with valence_schema!, generate Model APIs via valence-codegen in build.rs, and register backends through ValenceBuilder. One runtime may host heterogeneous engines; each operation stays on one backend. Host-specific ports (secrets, actor, endpoints, telemetry) inject at boot so privacy evaluation and ownership stay next to the data model instead of being bolted on later. Published as uf-valence on crates.io; Rust imports stay use valence::….
In the workspace
Unified Field apps compile Valence schemas into Model APIs and bind them through Valence::builder() so counters, identity, and product tables share one transparency layer across backends.Code sample
From the upstream getting-started docs — see also all code recipes on Resources.
Valence schemaValence
Schema DSL + builder backends
use std::sync::Arc;
use valence::{
Database, DatabaseFromEngine, FieldType, InMemoryBackend, Valence, MEM_ENGINE_ID,
valence_schema,
};
const COUNTER_DB: DatabaseFromEngine = Database::from_engine("default", MEM_ENGINE_ID);
valence_schema! {
Counter {
table: "counter",
version: "0.1.0",
description: "Simple counter",
database: COUNTER_DB,
fields: [
id: { r#type: FieldType::String, primary_key: true, required: true },
value: { r#type: FieldType::Integer, required: true },
],
}
}
let valence = Valence::builder()
.add_backend("default", Arc::new(InMemoryBackend::new()))
.build()?;