Expand description
Async ORM for TypeDB built on type-bridge-core-lib.
This crate provides:
TypeBridgeEntitytrait for mapping Rust structs to TypeDB entity typesTypeBridgeRelationtrait for mapping Rust structs to TypeDB relation typesTypeBridgeAttributetrait anddefine_attribute!macro for attribute typesEntityManager/RelationManagerfor typed CRUD operationsDescriptorRegistryplus dynamic managers for runtime schemasDatabase+Transaction+TransactionContextsession layerFilterfor equality-based queries
§Quick start
ⓘ
use type_bridge_orm::{
define_attribute, Database, EntityManager, Filter,
TypeBridgeEntity, OwnedAttributeInfo, AttributeValue,
};
// Define attribute types
define_attribute!(Name, "name", "string");
define_attribute!(Age, "age", "long");
// Define entity (manual impl; derive macros in a later phase)
struct Person { iid: Option<String>, name: Name, age: Age }
// impl TypeBridgeEntity for Person { ... }
// CRUD operations
let db = Database::connect("localhost:1729", "mydb", "admin", "password").await?;
let manager = EntityManager::<Person>::new(&db);
manager.insert(&mut person).await?;
let people = manager.all().await?;§Runtime descriptors
Runtime descriptors are the shared Rust substrate for generated schemas and language bindings. They are registered without a database and then used to construct dynamic managers:
ⓘ
use type_bridge_orm::{
DescriptorRegistry, DynamicEntityManager, EntityDescriptor,
OwnedAttributeDescriptor, ValueType,
};
let registry = DescriptorRegistry::new();
let person = registry.register_entity(EntityDescriptor {
type_name: "person".into(),
is_abstract: false,
parent_type: None,
owned_attributes: vec![OwnedAttributeDescriptor {
field_name: "name".into(),
attr_name: "name".into(),
value_type: ValueType::String,
annotations: vec![],
is_optional: false,
is_ordered: false,
}],
})?;
let manager = DynamicEntityManager::new(&db, person);Re-exports§
pub use attribute::TypeBridgeAttribute;pub use attribute::ValueType;pub use descriptor::EntityDescriptor;pub use descriptor::OwnedAttributeDescriptor;pub use descriptor::RelationDescriptor;pub use descriptor::RoleDescriptor;pub use descriptor::TypeDescriptor;pub use descriptor::TypeDescriptorRef;pub use dynamic::DynamicAggregate;pub use dynamic::DynamicAttributeMap;pub use dynamic::DynamicComparisonOp;pub use dynamic::DynamicEntityIdentity;pub use dynamic::DynamicEntityRow;pub use dynamic::DynamicExpr;pub use dynamic::DynamicRelationIdentity;pub use dynamic::DynamicRelationRow;pub use dynamic::DynamicRolePlayer;pub use dynamic::DynamicRolePlayerInput;pub use dynamic::DynamicSort;pub use entity::Annotation;pub use entity::OwnedAttributeInfo;pub use entity::TypeBridgeEntity;pub use error::ClassifiedCommitError;pub use error::CommitFailureCertainty;pub use error::OrmError;pub use error::Result;pub use expr::Agg;pub use expr::AggResult;pub use expr::Expr;pub use expr::GroupByResult;pub use expr::SortDir;pub use field_ref::FieldRef;pub use field_ref::RolePlayerFieldRef;pub use field_ref::RoleRef;pub use filter::Filter;pub use hooks::CrudOperation;pub use hooks::HookContext;pub use hooks::HookError;pub use hooks::HookRunner;pub use hooks::LifecycleHook;pub use hooks::PreHookResult;pub use hooks::TypeKind;pub use manager::DynamicEntityManager;pub use manager::DynamicRelationManager;pub use manager::EntityManager;pub use manager::RelationManager;pub use provider_runtime::ProviderRuntimeOwner;pub use query::EntityQuery;pub use query::GroupByEntityQuery;pub use query::GroupByRelationQuery;pub use query::RelationQuery;pub use registry::DescriptorRegistry;pub use relation::RoleInfo;pub use relation::RolePlayerRef;pub use relation::TypeBridgeRelation;pub use runtime_projection::InstalledRuntimeProjection;pub use schema::SchemaDiff;pub use schema::SchemaInfo;pub use schema::SchemaManager;pub use session::backend::AnswerCancellation;pub use session::Database;pub use session::DatabaseConnectionAuthority;pub use session::GivenRowsSpec;pub use session::GivenValue;pub use session::Transaction;pub use session::TransactionContext;pub use session::TxType;pub use session::require_legacy_writer_open;pub use session::require_legacy_writer_open_in_transaction;pub use session::database_exists;pub use session::database_exists_secure;pub use session::delete_database_secure;pub use session::ensure_database_exists;pub use session::ensure_database_exists_secure;pub use value::AttributeValue;pub use match_request::*;
Modules§
- attribute
- TypeDB attribute type trait and convenience macro.
- codegen
- Code generator: TypeQL schema → Rust source files.
- descriptor
- Owned runtime descriptors for dynamic ORM access.
- dynamic
- Dynamic rows and inputs used by runtime descriptor managers.
- entity
- TypeDB entity trait with default AST generation methods.
- error
- Unified error types for the ORM crate.
- expr
- Expression system for building typed queries.
- field_
ref - Type-safe field references for building query expressions.
- filter
- Query filters for entity lookups.
- hooks
- Lifecycle hook system for CRUD operations.
- manager
- Entity and relation managers with supporting modules.
- match_
request - Canonical, provider-neutral typed match request and result contract.
- migration_
assertion - TypeDB lowering and bounded execution for validated migration assertions.
- provider_
runtime - Tokio runtime ownership for synchronous language bindings.
- query
- Chainable query builders for entities and relations.
- query_
v2 - Deterministic TypeQL lowering for validated V2 query plans.
- query_
v2_ builder - Shared incremental authoring state machine for canonical V2 query plans.
- query_
v2_ prepared - Prepared-plan execution facade for idiomatic binding projections.
- query_
v2_ remote - Remote execution of validated query plans over the versioned envelope.
- registry
- Explicit runtime descriptor registry.
- relation
- TypeDB relation trait with default AST generation methods.
- runtime_
projection - Provider descriptors derived one-way from a trusted runtime projection.
- schema
- Schema management: registration, generation, diffing, and synchronization.
- session
- Session layer for TypeDB connectivity.
- value
- Typed attribute values corresponding to TypeDB value types.
Macros§
- define_
attribute - Define a TypeDB attribute type with a single line.
Structs§
- Claimed
Remote Model Reply V2 - The sole claimed reply slot for one adapted model request.
- Connect
Options - Connection-time options for the version-gated TypeDB runtime.
- Pending
Remote Model Query V2 - One adapted model request and its request-bound one-shot decoder.
- Secure
Connect Options - Connection options for the typed TLS transport surface.
Enums§
- Remote
Model Query V2Error - A model-query remote failure retains its native structured error family.
- Secure
Connect Error - Error returned by typed secure connection and lifecycle entry points.
- TlsMode
- Canonical TLS policy for secure TypeDB connections.
Functions§
- embedded_
driver_ versions - Return the driver versions compiled into this build, keyed by protocol band.
- prepare_
remote_ model_ query_ v2 - Adapt and prepare one released model-oriented terminal for remote V2 execution.
Type Aliases§
- Secure
Result - Result alias for typed secure connection and lifecycle operations.