1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! SurrealSink trait definition.
//!
//! This trait abstracts over SurrealDB SDK version differences, allowing
//! source crates to be compiled against a single interface that works
//! with both v2 and v3 servers.
use crate::;
use Result;
/// Trait for writing data to SurrealDB.
///
/// This trait provides version-independent operations for writing data
/// to SurrealDB. Implementations handle the SDK-specific details of
/// converting universal types to SurrealDB types.
///
/// # Usage Pattern
///
/// Source crates use generics for zero-cost dispatch:
///
/// ```ignore
/// pub async fn run_full_sync<S: SurrealSink>(
/// surreal: &S,
/// opts: &SourceOpts,
/// ) -> Result<()> {
/// // All calls here are statically dispatched after monomorphization
/// surreal.write_rows(&batch).await?;
/// }
/// ```
///
/// The CLI entry point branches once based on SDK version, and after
/// that all code is monomorphized for the specific implementation.