pub struct HyperQLSyntax;Implementations§
Source§impl HyperQLSyntax
impl HyperQLSyntax
Sourcepub fn documentation() -> &'static str
pub fn documentation() -> &'static str
Examples found in repository?
examples/developer_experience_demo.rs (line 50)
15fn main() -> Result<(), Box<dyn std::error::Error>> {
16 println!("š HyperQL Developer Experience Features Demo\n");
17
18 // 1. Query Builder API Demo
19 println!("š 1. QUERY BUILDER API");
20 println!("====================\n");
21
22 // Build a simple SELECT query
23 let simple_query = HyperQLBuilder::new()
24 .select(["name", "age"])
25 .from("users")
26 .where_eq("age", Value::Int(21))
27 .order_by("name", OrderDirection::Asc)
28 .limit(10)
29 .build()?;
30
31 println!("ā
Built query: {:?}\n", simple_query);
32
33 // Build a more complex query with multiple WHERE conditions
34 let complex_query = HyperQLBuilder::new()
35 .select(["*"])
36 .from("products")
37 .where_eq("category", Value::String("electronics".to_string()))
38 .where_eq("in_stock", Value::Bool(true))
39 .order_by("price", OrderDirection::Desc)
40 .limit(5)
41 .build()?;
42
43 println!("ā
Built complex query: {:?}\n", complex_query);
44
45 // 2. Documentation System Demo
46 println!("š 2. DOCUMENTATION SYSTEM");
47 println!("=========================\n");
48
49 // Show comprehensive documentation
50 let doc = HyperQLSyntax::documentation();
51 let doc_lines: Vec<&str> = doc.lines().take(15).collect();
52 println!("š HyperQL Documentation (first 15 lines):");
53 for line in doc_lines {
54 println!(" {}", line);
55 }
56 println!(" ... (truncated for demo)\n");
57
58 // Show categorized examples
59 let examples = HyperQLExamples::new();
60
61 println!("š Basic Query Examples:");
62 for (i, (desc, query)) in examples.basic.iter().take(3).enumerate() {
63 println!(" {}. {}: {}", i + 1, desc, query);
64 }
65 println!();
66
67 println!("š Geometric Query Examples:");
68 for (i, (desc, query)) in examples.geometric.iter().take(2).enumerate() {
69 println!(" {}. {}: {}", i + 1, desc, query);
70 }
71 println!();
72
73 println!("š Graph Traversal Examples:");
74 for (i, (desc, query)) in examples.graph.iter().take(2).enumerate() {
75 println!(" {}. {}: {}", i + 1, desc, query);
76 }
77 println!();
78
79 // Demonstrate keyword search
80 println!("š Searching examples with keyword 'SELECT':");
81 let select_examples = examples.find_examples_by_keyword("SELECT");
82 for (i, (desc, _query)) in select_examples.iter().take(3).enumerate() {
83 println!(" {}. {}", i + 1, desc);
84 }
85 println!();
86
87 // 3. Utility Functions Demo
88 println!("āļø 3. UTILITY FUNCTIONS");
89 println!("=====================\n");
90
91 // Entity by label utility
92 let label_query = query_utils::entity_by_label("Person")?;
93 println!("š¤ Find entities by label 'Person': {:?}\n", label_query);
94
95 // Geometric utilities
96 let near_query = query_utils::entities_near_point(1.0, 2.0, 3.0, 5.0)?;
97 println!("š Find entities near point (1,2,3) within radius 5.0: {:?}\n", near_query);
98
99 let within_query = query_utils::entities_within_radius("location", 0.0, 0.0, 0.0, 2.0)?;
100 println!("šÆ Find entities within radius 2.0 of origin: {:?}\n", within_query);
101
102 // Vector similarity search
103 let similarity_query = query_utils::vector_similarity_search(
104 "embeddings",
105 vec![0.1, 0.2, 0.3, 0.4],
106 10
107 )?;
108 println!("š¢ Vector similarity search (k=10): {:?}\n", similarity_query);
109
110 // Graph traversal utility
111 let traversal_query = query_utils::traverse_relationship(
112 "user",
113 "FRIENDS",
114 Some("friend")
115 )?;
116 println!("š Traverse friendship relationships: {:?}\n", traversal_query);
117
118 // Range query utility
119 let range_query = query_utils::entities_by_property_range(
120 "employees",
121 "salary",
122 50000,
123 100000
124 )?;
125 println!("š° Find employees by salary range: {:?}\n", range_query);
126
127 // Aggregation utility
128 let agg_query = query_utils::aggregate_by_property(
129 "sales",
130 "region",
131 "amount",
132 "SUM"
133 )?;
134 println!("š Aggregate sales by region: {:?}\n", agg_query);
135
136 println!("š Demo completed successfully!");
137 println!("\nš” Key Benefits:");
138 println!(" ⢠Type-safe query construction with the builder API");
139 println!(" ⢠Comprehensive documentation and examples built-in");
140 println!(" ⢠Pre-built utilities for common query patterns");
141 println!(" ⢠Fluent, discoverable API design");
142 println!(" ⢠Full integration with HyperQL's multi-paradigm capabilities");
143
144 Ok(())
145}pub fn basic_examples() -> Vec<(&'static str, &'static str)>
pub fn geometric_examples() -> Vec<(&'static str, &'static str)>
pub fn graph_examples() -> Vec<(&'static str, &'static str)>
pub fn vector_examples() -> Vec<(&'static str, &'static str)>
pub fn stream_examples() -> Vec<(&'static str, &'static str)>
pub fn timeseries_examples() -> Vec<(&'static str, &'static str)>
Auto Trait Implementations§
impl Freeze for HyperQLSyntax
impl RefUnwindSafe for HyperQLSyntax
impl Send for HyperQLSyntax
impl Sync for HyperQLSyntax
impl Unpin for HyperQLSyntax
impl UnsafeUnpin for HyperQLSyntax
impl UnwindSafe for HyperQLSyntax
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more