This repo contains a minimal EdgeDB setup with a schema based on the tutorial, and a few sample queries:
- Simple scalar queries
- Queries to return an Object and how to work with the Value enum
- Query returning json to then deserialize into a Rust struct
- Query using the Queryable derive macro, allowing deserializing into a Rust struct without needing intermediary json
- Queries using arguments (e.g. $0, $1, etc.) requiring casts in EdgeDB and showing the relation between Rust and EdgeDB types
First clone the repo, then:
- Make sure you have EdgeDB installed
- Type
edgedb project init
and follow a few quick instructions. (Call the projectexample
or whatever you like) You should have a running instance. - (Optional if curious: type
edgedb instance list
to see it and then typeedgedb
if you want to play around with the REPL a bit. (You can also typeedgedb ui
if you want to work through the UI) The schema hasn't been applied yet, so leave the REPL with\quit
and:) - Type
edgedb migration create
. You should see a file called00001.edgeql
show up in themigrations
folder. You don't need to do anything with this file - it's just a record of the instructions used to migrate the schema to its current state. (Very readable though so take a look if curious) - Type
edgedb migrate
to finish the migration. - Then just type
cargo run
and see the output.