Skip to main content

Crate type_bridge_orm

Crate type_bridge_orm 

Source
Expand description

Async ORM for TypeDB built on type-bridge-core-lib.

This crate provides:

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

Re-exports§

pub use attribute::TypeBridgeAttribute;
pub use attribute::ValueType;
pub use entity::Annotation;
pub use entity::OwnedAttributeInfo;
pub use entity::TypeBridgeEntity;
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::EntityManager;
pub use manager::RelationManager;
pub use query::EntityQuery;
pub use query::GroupByEntityQuery;
pub use query::GroupByRelationQuery;
pub use query::RelationQuery;
pub use relation::RoleInfo;
pub use relation::RolePlayerRef;
pub use relation::TypeBridgeRelation;
pub use schema::SchemaDiff;
pub use schema::SchemaInfo;
pub use schema::SchemaManager;
pub use session::Database;
pub use session::Transaction;
pub use session::TransactionContext;
pub use session::TxType;
pub use value::AttributeValue;

Modules§

attribute
TypeDB attribute type trait and convenience macro.
codegen
Code generator: TypeQL schema → Rust source files.
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.
query
Chainable query builders for entities and relations.
relation
TypeDB relation trait with default AST generation methods.
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.