Skip to content

Commit

Permalink
docs: small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed Aug 25, 2024
1 parent aa101f0 commit 2a6d65d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions crates/edgedb_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
name = "edgedb_codegen"
readme = "readme.md"
categories = ["database"]
keywords = ["edgedb", "database", "typesafe", "checked"]
keywords = ["edgedb", "database", "typesafe", "checked", "macros"]
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
rust-version = { workspace = true }
description = "Generates fully typed rust code from an edgedb schema and inline / file-based queries."
description = "Generate fully typed rust code from your EdgeDB schema and inline queries."

[dependencies]
bigdecimal = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/edgedb_codegen/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `edgedb_codegen`

> Generates fully typed rust code from an edgedb schema and inline / file-based queries.
> Generate fully typed rust code from your EdgeDB schema and inline queries.
[![Crate][crate-image]][crate-link] [![Docs][docs-image]][docs-link] [![Status][ci-status-image]][ci-status-link] [![Unlicense][unlicense-image]][unlicense-link]

Expand Down
19 changes: 11 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `edgedb_codegen`

> Generate fully typed rust code from your edgedb schema and inline / file-based queries.
> Generate fully typed rust code from your EdgeDB schema and inline queries.
[![Crate][crate-image]][crate-link] [![Docs][docs-image]][docs-link] [![Status][ci-status-image]][ci-status-link] [![Unlicense][unlicense-image]][unlicense-link]

Expand Down Expand Up @@ -28,7 +28,7 @@ Fortunately, `edgedb` has a query language that is typed and can be converted in

```rust
use edgedb_codegen::edgedb_query;
use edgedb_errors::Result;
use edgedb_errors::Error;
use edgedb_tokio::create_client;

// Creates a module called `simple` with a function called `query` and structs
Expand All @@ -38,8 +38,8 @@ edgedb_query!(
"select {hello := \"world\", custom := <str>$custom }"
);

#[toko::main]
async fn main() -> Result<()> {
#[tokio::main]
async fn main() -> Result<(), Error> {
let client = create_client().await?;
let input = simple::Input::builder().custom("custom").build();

Expand Down Expand Up @@ -70,26 +70,29 @@ Then use the `edgedb_query` macro to import the query.

```rust
use edgedb_codegen::edgedb_query;
use edgedb_errors::Error;
use edgedb_tokio::create_client;

// Creates a module called `select_user` with public functions `transaction` and
// `query` as well as structs for the `Input` and `Output`.
edgedb_query!(select_user);

#[toko::main]
async fn main() -> Result<()> {
#[tokio::main]
async fn main() -> Result<(), Error> {
let client = create_client().await?;
let input = select_user::Input::builder().slug("test").build();

// Generated code can be run inside a transaction.
let result = client
.transaction(|mut txn| {
async move {
let output = select_user::transaction(&mut txn).await?;
let input = select_user::Input::builder().slug("test").build();
let output = select_user::transaction(&mut txn, &input).await?;
Ok(output)
}
})
.await?;

Ok(())
}
```

Expand Down

0 comments on commit 2a6d65d

Please sign in to comment.