-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implemented Rust API * Fix tense * Made functions const which didn't need to be mutable The rust API needs to call them from a const context.
- Loading branch information
1 parent
75526c9
commit c37c9bb
Showing
32 changed files
with
3,183 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "kuzu-rust-example" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
kuzu = {path="../../tools/rust_api"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use kuzu::{Connection, Database, Error}; | ||
|
||
fn main() -> Result<(), Error> { | ||
let db = Database::new( | ||
std::env::args() | ||
.nth(1) | ||
.expect("The first CLI argument should be the database path"), | ||
0, | ||
)?; | ||
let connection = Connection::new(&db)?; | ||
|
||
// Create schema. | ||
connection.query("CREATE NODE TABLE Person(name STRING, age INT64, PRIMARY KEY(name));")?; | ||
// Create nodes. | ||
connection.query("CREATE (:Person {name: 'Alice', age: 25});")?; | ||
connection.query("CREATE (:Person {name: 'Bob', age: 30});")?; | ||
|
||
// Execute a simple query. | ||
let mut result = connection.query("MATCH (a:Person) RETURN a.name AS NAME, a.age AS AGE;")?; | ||
|
||
// Print query result. | ||
println!("{}", result.display()); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.