Skip to main content

HyperQLSyntax

Struct HyperQLSyntax 

Source
pub struct HyperQLSyntax;

Implementations§

Source§

impl HyperQLSyntax

Source

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}
Source

pub fn basic_examples() -> Vec<(&'static str, &'static str)>

Source

pub fn geometric_examples() -> Vec<(&'static str, &'static str)>

Source

pub fn graph_examples() -> Vec<(&'static str, &'static str)>

Source

pub fn vector_examples() -> Vec<(&'static str, &'static str)>

Source

pub fn stream_examples() -> Vec<(&'static str, &'static str)>

Source

pub fn timeseries_examples() -> Vec<(&'static str, &'static str)>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.