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
//! # somnia — Type-safe SurrealDB ORM
//!
//! ```ignore
//! use somnia::{SomniaClient, SurrealRecord, Thing};
//! use somnia_derive::SurrealRecord;
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(SurrealRecord, Serialize, Deserialize)]
//! #[table("asset")]
//! struct Asset {
//! #[field(thing)]
//! id: Thing<Asset>,
//! name: String,
//! #[field(name = "content_type")]
//! content_type: Option<String>,
//! file_size: Option<i64>,
//! }
//!
//! async fn example() -> Result<(), SomniaError> {
//! let db = SomniaClient::connect("ws://localhost:8000", "root", "root", "ns", "db").await?;
//!
//! // Typed column accessors are generated by the derive macro:
//! let videos: Vec<Asset> = db.query(
//! &Asset::table()
//! .select(Asset::all())
//! .filter(Asset::name().eq("video/mp4".to_string()))
//! .filter(Asset::file_size().gt(1024 * 1024))
//! .limit(10)
//! ).await?;
//!
//! let db = db;
//! Ok(())
//! }
//! ```
pub use ;
pub use ;
pub use ;