seaography examples

This commit is contained in:
Billy Chan 2024-05-02 14:13:40 +08:00
parent 7f0290de3f
commit 8687407257
No known key found for this signature in database
GPG Key ID: 45461E52F22E0279
4 changed files with 14 additions and 9 deletions

View File

@ -25,7 +25,7 @@ cargo run
## Install Seaography ## Install Seaography
```sh ```sh
cargo install seaography-cli@^1.0.0-rc.2 cargo install seaography-cli@^1.0.0-rc.3
``` ```
## Generate GraphQL project ## Generate GraphQL project

View File

@ -5,23 +5,28 @@ version = "0.3.0"
publish = false publish = false
[dependencies] [dependencies]
poem = { version = "1.3.56" } poem = { version = "3.0" }
async-graphql-poem = { version = "5.0.10" } async-graphql-poem = { version = "7.0" }
async-graphql = { version = "5.0.10", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] } async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
async-trait = { version = "0.1.72" } async-trait = { version = "0.1.72" }
dotenv = "0.15.0" dotenv = "0.15.0"
sea-orm = { version = "0.12.0", features = ["sqlx-mysql", "runtime-async-std-native-tls", "seaography"] } sea-orm = { path = "../../../", features = ["sqlx-mysql", "runtime-async-std-native-tls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" } tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" } tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" } lazy_static = { version = "1.4.0" }
[dependencies.seaography] [dependencies.seaography]
version = "1.0.0-rc.2" # seaography version version = "1.0.0-rc.3" # seaography version
features = ["with-decimal", "with-chrono"] features = ["with-decimal", "with-chrono"]
[dev-dependencies] [dev-dependencies]
serde_json = { version = "1.0.103" } serde_json = { version = "1.0.103" }
[workspace] [workspace]
members = [] members = []
# This allows us to develop using a local version of sea-orm
# remove this section in your own project
[patch.crates-io]
sea-orm = { path = "../../../" }

View File

@ -11,7 +11,7 @@ pub fn schema(
depth: Option<usize>, depth: Option<usize>,
complexity: Option<usize>, complexity: Option<usize>,
) -> Result<Schema, SchemaError> { ) -> Result<Schema, SchemaError> {
let mut builder = Builder::new(&CONTEXT); let mut builder = Builder::new(&CONTEXT, database.clone());
seaography::register_entities!(builder, [baker, bakery, cake, cake_baker,]); seaography::register_entities!(builder, [baker, bakery, cake, cake_baker,]);
let schema = builder.schema_builder(); let schema = builder.schema_builder();
let schema = if let Some(depth) = depth { let schema = if let Some(depth) = depth {

View File

@ -14,7 +14,7 @@ path = "src/lib.rs"
async-std = { version = "1", features = ["attributes", "tokio1"] } async-std = { version = "1", features = ["attributes", "tokio1"] }
[dependencies.sea-orm] [dependencies.sea-orm]
path = "../../.." # remove this line in your own project path = "../../../" # remove this line in your own project
version = "1.0.0-rc.3" # sea-orm version version = "1.0.0-rc.3" # sea-orm version
[dependencies.sea-orm-migration] [dependencies.sea-orm-migration]