surreal-sync-core 0.6.0

Core types, SurrealSink, transform/sink-connect traits, and checkpoint API for surreal-sync
Documentation

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();