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 initand follow a few quick instructions. (Call the projectexampleor whatever you like) You should have a running instance. - (Optional if curious: type
edgedb instance listto see it and then typeedgedbif you want to play around with the REPL a bit. (You can also typeedgedb uiif you want to work through the UI) The schema hasn't been applied yet, so leave the REPL with\quitand:) - Type
edgedb migration create. You should see a file called00001.edgeqlshow up in themigrationsfolder. 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 migrateto finish the migration. - Then just type
cargo runand see the output.