Skip to content

Commit

Permalink
[docs] Add missing usings to quickstart example #618 (#619)
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
michaelvlach authored Jul 2, 2023
1 parent be9068e commit 3d15dbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ cargo add agdb
Basic usage demonstrating creating a database, inserting graph elements with data and querying them back with select and search. The function using this code must handle `agdb::DbError` and [`agdb::QueryError`](docs/queries.md#queryerror) error types for operator `?` to work:

```Rust
use agdb::Db;
use agdb::QueryBuilder;
use agdb::Comparison::Equal;

let mut db = Db::new("user_db.agdb")?;

db.exec_mut(&QueryBuilder::insert().nodes().aliases("users").query())?;
Expand Down Expand Up @@ -59,7 +63,7 @@ let user = db.exec(&QueryBuilder::select()
.from("users")
.where_()
.key("username")
.value(Comparison::Equal("John".into()))
.value(Equal("John".into()))
.query())
.query())?;
println!("{:?}", user);
Expand Down
4 changes: 2 additions & 2 deletions tests/examples.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod test_db;

use crate::test_db::TestFile;
use agdb::Comparison;
use agdb::Comparison::Equal;
use agdb::Db;
use agdb::QueryBuilder;

Expand Down Expand Up @@ -50,7 +50,7 @@ fn quickstart() {
.from("users")
.where_()
.key("username")
.value(Comparison::Equal("user_2".into()))
.value(Equal("user_2".into()))
.query(),
)
.query(),
Expand Down

0 comments on commit 3d15dbc

Please sign in to comment.