blocking_http/
blocking_http.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the MIT
3
4use reifydb_client::Client;
5
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7	let client = Client::http(("127.0.0.1", 8090))?;
8
9	// Create a blocking session with authentication
10	let mut session = client.blocking_session(Some("mysecrettoken".to_string()))?;
11
12	// Execute a command to create a table
13	let command_result =
14		session.command("CREATE NAMESPACE test; CREATE TABLE test.users { id: INT4, name: UTF8 }", None)?;
15	println!("Command executed: {} frames returned", command_result.frames.len());
16
17	// Execute a query
18	let query_result = session.query("MAP { x: 42, y: 'hello' }", None)?;
19
20	println!("Query executed: {} frames returned", query_result.frames.len());
21
22	// Print first frame if available
23	if let Some(frame) = query_result.frames.first() {
24		println!("First frame:\n{}", frame);
25	}
26
27	Ok(())
28}