Skip to content

Commit

Permalink
Re-export async_graphql and lazy_static (#183)
Browse files Browse the repository at this point in the history
* Re-export `async_graphql` and `lazy_static`

* fmt

* nit

* bump
  • Loading branch information
billy1624 authored Jan 10, 2025
1 parent 2b3193d commit 1bde6c6
Show file tree
Hide file tree
Showing 30 changed files with 42 additions and 44 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ categories = ["database"]

[dependencies]
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
sea-orm = { version = "~1.1.2", default-features = false, features = ["seaography"] }
sea-orm = { version = "~1.1.4", default-features = false, features = ["seaography"] }
itertools = { version = "0.12.0" }
heck = { version = "0.4.1" }
thiserror = { version = "1.0.44" }
fnv = { version = "1.0.7" }
lazy_static = { version = "1.5" }

[features]
default = ["field-camel-case"]
Expand Down
4 changes: 1 addition & 3 deletions examples/mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "1.1.2"
[dependencies]
axum = { version = "0.7" }
async-graphql-axum = { version = "7.0" }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.2", features = ["sqlx-mysql", "runtime-async-std-native-tls", "seaography"] }
sea-orm = { version = "~1.1.4", features = ["sqlx-mysql", "runtime-async-std-native-tls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
path = "../../"
Expand Down
4 changes: 2 additions & 2 deletions examples/mysql/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use axum::{
Router,
};
use dotenv::dotenv;
use lazy_static::lazy_static;
use sea_orm::Database;
use seaography::{async_graphql, lazy_static};
use std::env;
use tokio::net::TcpListener;

lazy_static! {
lazy_static::lazy_static! {
static ref URL: String = env::var("URL").unwrap_or("localhost:8000".into());
static ref ENDPOINT: String = env::var("ENDPOINT").unwrap_or("/".into());
static ref DATABASE_URL: String =
Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/src/query_root.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::entities::*;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext};

lazy_static::lazy_static! { static ref CONTEXT : BuilderContext = BuilderContext :: default () ; }

Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/tests/guard_mutation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::BTreeMap;

use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection};
use seaography::{Builder, BuilderContext, FnGuard, GuardsConfig};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext, FnGuard, GuardsConfig};
use seaography_mysql_example::entities::*;

lazy_static::lazy_static! {
Expand Down
4 changes: 2 additions & 2 deletions examples/mysql/tests/guard_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::collections::BTreeMap;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection, RelationTrait};
use seaography::{
Builder, BuilderContext, EntityObjectRelationBuilder, EntityObjectViaRelationBuilder, FnGuard,
GuardsConfig,
async_graphql, lazy_static, Builder, BuilderContext, EntityObjectRelationBuilder,
EntityObjectViaRelationBuilder, FnGuard, GuardsConfig,
};

lazy_static::lazy_static! {
Expand Down
1 change: 1 addition & 0 deletions examples/mysql/tests/mutation_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;
use seaography::async_graphql;

async fn main() {
test_simple_insert_one().await;
Expand Down
1 change: 1 addition & 0 deletions examples/mysql/tests/query_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;
use seaography::async_graphql;

pub async fn get_schema() -> Schema {
let database = Database::connect("mysql://sea:[email protected]/sakila")
Expand Down
4 changes: 1 addition & 3 deletions examples/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "1.1.2"
[dependencies]
poem = { version = "3.0" }
async-graphql-poem = { version = "7.0" }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.2", features = ["sqlx-postgres", "runtime-async-std-native-tls", "seaography"] }
sea-orm = { version = "~1.1.4", features = ["sqlx-postgres", "runtime-async-std-native-tls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
path = "../../"
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql_poem::GraphQL;
use dotenv::dotenv;
use lazy_static::lazy_static;
use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server};
use sea_orm::Database;
use seaography::{async_graphql, lazy_static};
use std::env;

lazy_static! {
lazy_static::lazy_static! {
static ref URL: String = env::var("URL").unwrap_or("localhost:8000".into());
static ref ENDPOINT: String = env::var("ENDPOINT").unwrap_or("/".into());
static ref DATABASE_URL: String =
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/src/query_root.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::entities::*;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext};

lazy_static::lazy_static! { static ref CONTEXT : BuilderContext = BuilderContext :: default () ; }

Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/tests/guard_mutation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::BTreeMap;

use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection};
use seaography::{Builder, BuilderContext, FnGuard, GuardsConfig};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext, FnGuard, GuardsConfig};
use seaography_postgres_example::entities::*;

lazy_static::lazy_static! {
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/tests/guard_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::collections::BTreeMap;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection, RelationTrait};
use seaography::{
Builder, BuilderContext, EntityObjectRelationBuilder, EntityObjectViaRelationBuilder, FnGuard,
GuardsConfig,
async_graphql, lazy_static, Builder, BuilderContext, EntityObjectRelationBuilder,
EntityObjectViaRelationBuilder, FnGuard, GuardsConfig,
};

lazy_static::lazy_static! {
Expand Down
1 change: 1 addition & 0 deletions examples/postgres/tests/mutation_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;
use seaography::async_graphql;

#[tokio::test]
async fn main() {
Expand Down
1 change: 1 addition & 0 deletions examples/postgres/tests/query_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;
use seaography::async_graphql;

pub async fn get_schema() -> Schema {
let database = Database::connect("postgres://sea:[email protected]/sakila")
Expand Down
4 changes: 1 addition & 3 deletions examples/sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "1.1.2"
[dependencies]
actix-web = { version = "4.5", default-features = false, features = ["macros"] }
async-graphql-actix-web = { version = "7.0" }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.2", features = ["sqlx-sqlite", "runtime-async-std-rustls", "seaography"] }
sea-orm = { version = "~1.1.4", features = ["sqlx-sqlite", "runtime-async-std-rustls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
path = "../../"
Expand Down
4 changes: 2 additions & 2 deletions examples/sqlite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use async_graphql::{
};
use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse};
use dotenv::dotenv;
use lazy_static::lazy_static;
use sea_orm::Database;
use seaography::{async_graphql, lazy_static};
use std::env;

lazy_static! {
lazy_static::lazy_static! {
static ref URL: String = env::var("URL").unwrap_or("localhost:8000".into());
static ref ENDPOINT: String = env::var("ENDPOINT").unwrap_or("/".into());
static ref DATABASE_URL: String =
Expand Down
2 changes: 1 addition & 1 deletion examples/sqlite/src/query_root.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::entities::*;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext};

lazy_static::lazy_static! { static ref CONTEXT : BuilderContext = BuilderContext :: default () ; }

Expand Down
2 changes: 1 addition & 1 deletion examples/sqlite/tests/guard_mutation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::BTreeMap;

use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection};
use seaography::{Builder, BuilderContext, FnGuard, GuardsConfig};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext, FnGuard, GuardsConfig};
use seaography_sqlite_example::entities::*;

lazy_static::lazy_static! {
Expand Down
4 changes: 2 additions & 2 deletions examples/sqlite/tests/guard_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::collections::BTreeMap;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection, RelationTrait};
use seaography::{
Builder, BuilderContext, EntityObjectRelationBuilder, EntityObjectViaRelationBuilder, FnGuard,
GuardsConfig,
async_graphql, lazy_static, Builder, BuilderContext, EntityObjectRelationBuilder,
EntityObjectViaRelationBuilder, FnGuard, GuardsConfig,
};

lazy_static::lazy_static! {
Expand Down
1 change: 1 addition & 0 deletions examples/sqlite/tests/mutation_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;
use seaography::async_graphql;

#[tokio::test]
async fn main() {
Expand Down
1 change: 1 addition & 0 deletions examples/sqlite/tests/query_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;
use seaography::async_graphql;

pub async fn get_schema() -> Schema {
let database = Database::connect("sqlite://sakila.db").await.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions generator/src/templates/actix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ pub fn generate_main(crate_name: &str) -> TokenStream {
};
use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse};
use dotenv::dotenv;
use lazy_static::lazy_static;
use sea_orm::Database;
use seaography::{async_graphql, lazy_static};
use std::env;

lazy_static! {
lazy_static::lazy_static! {
static ref URL: String = env::var("URL").unwrap_or("localhost:8000".into());
static ref ENDPOINT: String = env::var("ENDPOINT").unwrap_or("/".into());
static ref DATABASE_URL: String =
Expand Down
4 changes: 1 addition & 3 deletions generator/src/templates/actix_cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "0.1.0"
[dependencies]
actix-web = { version = "4.5", default-features = false, features = ["macros"] }
async-graphql-actix-web = { version = "7.0" }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.2", features = ["<seaography-sql-library>", "runtime-async-std-native-tls", "seaography"] }
sea-orm = { version = "~1.1.4", features = ["<seaography-sql-library>", "runtime-async-std-native-tls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
version = "~<seaography-version>" # seaography version
Expand Down
4 changes: 2 additions & 2 deletions generator/src/templates/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ pub fn generate_main(crate_name: &str) -> TokenStream {
Router,
};
use dotenv::dotenv;
use lazy_static::lazy_static;
use sea_orm::Database;
use seaography::{async_graphql, lazy_static};
use std::env;
use tokio::net::TcpListener;

lazy_static! {
lazy_static::lazy_static! {
static ref URL: String = env::var("URL").unwrap_or("localhost:8000".into());
static ref ENDPOINT: String = env::var("ENDPOINT").unwrap_or("/".into());
static ref DATABASE_URL: String =
Expand Down
4 changes: 1 addition & 3 deletions generator/src/templates/axum_cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "0.1.0"
[dependencies]
axum = { version = "0.7" }
async-graphql-axum = { version = "7.0" }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.2", features = ["<seaography-sql-library>", "runtime-async-std-native-tls", "seaography"] }
sea-orm = { version = "~1.1.4", features = ["<seaography-sql-library>", "runtime-async-std-native-tls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
version = "~<seaography-version>" # seaography version
Expand Down
4 changes: 2 additions & 2 deletions generator/src/templates/poem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ pub fn generate_main(crate_name: &str) -> TokenStream {
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql_poem::GraphQL;
use dotenv::dotenv;
use lazy_static::lazy_static;
use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server};
use sea_orm::Database;
use seaography::{async_graphql, lazy_static};
use std::env;

lazy_static! {
lazy_static::lazy_static! {
static ref URL: String = env::var("URL").unwrap_or("localhost:8000".into());
static ref ENDPOINT: String = env::var("ENDPOINT").unwrap_or("/".into());
static ref DATABASE_URL: String =
Expand Down
4 changes: 1 addition & 3 deletions generator/src/templates/poem_cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ version = "0.1.0"
[dependencies]
poem = { version = "3.0" }
async-graphql-poem = { version = "7.0" }
async-graphql = { version = "7.0", features = ["decimal", "chrono", "dataloader", "dynamic-schema"] }
dotenv = "0.15.0"
sea-orm = { version = "~1.1.2", features = ["<seaography-sql-library>", "runtime-async-std-native-tls", "seaography"] }
sea-orm = { version = "~1.1.4", features = ["<seaography-sql-library>", "runtime-async-std-native-tls", "seaography"] }
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.37" }
tracing-subscriber = { version = "0.3.17" }
lazy_static = { version = "1.4.0" }

[dependencies.seaography]
version = "~<seaography-version>" # seaography version
Expand Down
2 changes: 1 addition & 1 deletion generator/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn generate_query_root<P: AsRef<Path>>(entities_path: &P) -> TokenStream {
use crate::entities::*;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
use seaography::{async_graphql, lazy_static, Builder, BuilderContext};

lazy_static::lazy_static! {
static ref CONTEXT: BuilderContext = BuilderContext::default();
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,6 @@ pub use error::*;

pub type SimpleNamingFn = Box<dyn Fn(&str) -> String + Sync + Send>;
pub type ComplexNamingFn = Box<dyn Fn(&str, &str) -> String + Sync + Send>;

pub use async_graphql;
pub use lazy_static;

0 comments on commit 1bde6c6

Please sign in to comment.