Object Types

Dynamic schema definitions created via builder pattern. Each ObjectType has properties, computed properties, interface implementations, and an optional primary key.

Builder Example

Rust
let hvac = ObjectType::builder("hvac_unit")
    .description("HVAC zone controller")
    .version(1)
    .property(PropertyDef::new("temperature", PropertyType::F64)
        .with_unit("°C")
        .with_constraint(PropertyConstraint::Range { min: -40.0, max: 80.0 })
        .required())
    .property(PropertyDef::new("setpoint", PropertyType::F64)
        .with_unit("°C")
        .with_default(PropertyValue::F64(22.0)))
    .property(PropertyDef::new("mode", PropertyType::Enum(vec![
        "off".into(), "cool".into(), "heat".into(),
    ])))
    .implements(locatable_iface_id)
    .primary_key("unit_id")
    .build();

let id = type_registry.register_object_type(hvac)?;

Property Types (20)

F64F32I64StringBoolTimestampDateDecimalBytesEnum(...)GeoPointGeoShapeStruct(...)Array(...)TimeSeries(...)Map{k,v}AttachmentMarkingNull

Constraints

ConstraintDescription
Rangemin/max bounds for numeric types
EnumValuesAllowed string values
PatternRegex pattern for string validation
MinLengthMinimum string/array length
MaxLengthMaximum string/array length

Computed Properties

Derived from expressions with dependency tracking and configurable caching (AlwaysCompute, InvalidateOnDependency, TTL).

Rust
ComputedPropertyDef::new("comfort_index",
    Expr::Arithmetic {
        left: Box::new(Expr::Literal(PropertyValue::F64(100.0))),
        op: ArithmeticOp::Sub,
        right: Box::new(Expr::Property(PropertyRef::direct("temp_deviation"))),
    },
    PropertyType::F64,
).materialized()
 .with_cache_policy(CachePolicy::InvalidateOnDependency)

Questions?

Reach out for help with integration, deployment, or custom domain codecs.