Getting Started
This example can be found on SeaORM + Seaography Example.
To get started, all you need is a live SQL database with schema. You can code everything in Rust by writing SeaORM migrations, or design the schema with a GUI tool (e.g. DataGrip).
Install Seaography
cargo install seaography-cli@^1.1.0
Generate Seaography Entities
sea-orm-cli generate entity --output-dir graphql/src/entities --seaography
Generate entities with sea-orm-cli
, but with an additional --seaography
flag. The entities are basically good-old SeaORM entities, but with additional RelatedEntity
enum.
Generate GraphQL Project
# seaography-cli <DESTINATION> <ENTITIES> <DATABASE_URL> <CRATE_NAME>
seaography-cli graphql graphql/src/entities $DATABASE_URL sea-orm-seaography-example
Start the server
cd graphql
cargo run
You are of course free to modify the project to suit your needs. But the interesting bit starts at the seaography::register_entity!
macro and the seaography::Builder.