Skip to main content

Crate surreal_sync_core

Crate surreal_sync_core 

Source
Expand description

Core types for the surreal-sync framework.

This crate provides the foundational types used across the sync framework, including:

  • Type - Universal type representation for all supported databases
  • Value - Raw generated values before type conversion
  • TypedValue - Values with type information for conversion
  • Row - Intermediate row representation
  • Schema - Schema definitions loaded from YAML

§Architecture

The surreal-sync-core crate sits at the foundation of the sync framework:

surreal-sync-core (this crate)
   │
   ├─── loadtest-generator  (depends on surreal-sync-core for types)
   │
   ├─── surreal-sync-mysql  (implements From/Into for MySQL)
   ├─── surreal-sync-postgresql::types    (implements From/Into for PostgreSQL)
   ├─── mongodb-types       (implements From/Into for MongoDB)
   ├─── surrealdb-types     (implements From/Into for SurrealDB)
   └─── surreal-sync-json::types          (implements From/Into for JSON/CSV)

§Example

use surreal_sync_core::types::Type;
use surreal_sync_core::values::{Value, TypedValue};

// Create a typed value using factory methods
let value = TypedValue::int32(42);

// For dynamic types (e.g., from schema), use try_with_type for validation:
let dynamic_value = TypedValue::try_with_type(
    Type::Int32,
    Value::Int32(42)
).expect("valid type-value combination");

// Type-specific crates implement From<TypedValue> for their native types:
// let mysql_value: MySQLValue = value.into();

Re-exports§

pub use sink::SinkConnect;
pub use sink::SinkWithCheckpoints;
pub use sink::SurrealConfig;
pub use sink::SurrealSdkVersion;
pub use sink::SurrealSink;
pub use checkpoint::Checkpoint;
pub use checkpoint::CheckpointFile;
pub use checkpoint::CheckpointID;
pub use checkpoint::CheckpointStorage;
pub use checkpoint::CheckpointStore;
pub use checkpoint::InterleavedSnapshotCheckpoint;
pub use checkpoint::NullStore;
pub use checkpoint::NullSyncManager;
pub use checkpoint::SnapshotCheckpointer;
pub use checkpoint::SnapshotTableProgress;
pub use checkpoint::StoredCheckpoint;
pub use checkpoint::SyncConfig;
pub use checkpoint::SyncManager;
pub use checkpoint::SyncPhase;
pub use transform::InPlaceTransform;
pub use transform::Passthrough;
pub use foreign_keys::classify_table;
pub use foreign_keys::ForeignKeyDefinition;
pub use foreign_keys::TableKind;
pub use id_columns::apply_id_column_overrides;
pub use id_columns::build_composite_record_id;
pub use id_columns::flatten_composite_id;
pub use id_columns::parse_id_column_overrides;
pub use id_columns::stringify_id_part;
pub use id_columns::IdColumnOverrides;
pub use id_columns::IdColumnsError;
pub use schema::ColumnDefinition;
pub use schema::DatabaseSchema;
pub use schema::TableDefinition;
pub use schema::FieldDefinition;
pub use schema::GeneratorConfig;
pub use schema::GeneratorFieldDefinition;
pub use schema::GeneratorIDDefinition;
pub use schema::GeneratorSchema;
pub use schema::GeneratorTableDefinition;
pub use schema::IDDefinition;
pub use schema::Schema;
pub use schema::SchemaError;
pub use schema::TableDefinitionWithGenerators;
pub use relation_change::RelationChange;
pub use types::GeometryType;
pub use types::ToDdl;
pub use types::Type;
pub use values::Change;
pub use values::ChangeOp;
pub use values::GeometryData;
pub use values::Relation;
pub use values::Row;
pub use values::RowBuilder;
pub use values::RowConverter;
pub use values::ThingRef;
pub use values::TypedValue;
pub use values::TypedValueError;
pub use values::Value;
pub use values::ZeroTemporalPolicy;

Modules§

checkpoint
Checkpoint management API for surreal-sync.
foreign_keys
Foreign key definitions and table classification.
id_columns
Primary-key / record-ID column helpers shared across sources.
relation_change
Relation change type for incremental sync of graph edges.
schema
Schema definitions for the surreal-sync framework.
sink
SurrealDB sink trait abstraction.
transform
In-place transform trait and passthrough implementation.
types
Core data types for the surreal-sync load testing framework.
values
Value representations for the surreal-sync load testing framework.

Type Aliases§

LoadTestSchemaDeprecated