Skip to content

Commit

Permalink
Re-export async_graphql and lazy_static
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Jan 8, 2025
1 parent 66053f7 commit a0a507b
Show file tree
Hide file tree
Showing 30 changed files with 48 additions and 24 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
2 changes: 0 additions & 2 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"] }
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
5 changes: 3 additions & 2 deletions examples/mysql/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql_axum::GraphQL;
use axum::{
Expand All @@ -6,12 +7,12 @@ use axum::{
Router,
};
use dotenv::dotenv;
use lazy_static::lazy_static;
use seaography::lazy_static;
use sea_orm::Database;
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: 2 additions & 0 deletions examples/mysql/src/query_root.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::entities::*;
use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
Expand Down
2 changes: 2 additions & 0 deletions examples/mysql/tests/guard_mutation_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::BTreeMap;

use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection};
use seaography::{Builder, BuilderContext, FnGuard, GuardsConfig};
Expand Down
2 changes: 2 additions & 0 deletions examples/mysql/tests/guard_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::BTreeMap;

use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection, RelationTrait};
use seaography::{
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,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

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,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

Expand Down
2 changes: 0 additions & 2 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"] }
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
5 changes: 3 additions & 2 deletions examples/postgres/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use seaography::async_graphql;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql_poem::GraphQL;
use dotenv::dotenv;
use lazy_static::lazy_static;
use seaography::lazy_static;
use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server};
use sea_orm::Database;
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: 2 additions & 0 deletions examples/postgres/src/query_root.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::entities::*;
use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
Expand Down
2 changes: 2 additions & 0 deletions examples/postgres/tests/guard_mutation_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::BTreeMap;

use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection};
use seaography::{Builder, BuilderContext, FnGuard, GuardsConfig};
Expand Down
2 changes: 2 additions & 0 deletions examples/postgres/tests/guard_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::BTreeMap;

use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection, RelationTrait};
use seaography::{
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,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

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,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

Expand Down
2 changes: 0 additions & 2 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"] }
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
5 changes: 3 additions & 2 deletions examples/sqlite/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer, Result};
use seaography::async_graphql;
use async_graphql::{
dynamic::*,
http::{playground_source, GraphQLPlaygroundConfig},
};
use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse};
use dotenv::dotenv;
use lazy_static::lazy_static;
use seaography::lazy_static;
use sea_orm::Database;
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: 2 additions & 0 deletions examples/sqlite/src/query_root.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::entities::*;
use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
Expand Down
2 changes: 2 additions & 0 deletions examples/sqlite/tests/guard_mutation_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::BTreeMap;

use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection};
use seaography::{Builder, BuilderContext, FnGuard, GuardsConfig};
Expand Down
2 changes: 2 additions & 0 deletions examples/sqlite/tests/guard_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::BTreeMap;

use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::{dynamic::*, Response};
use sea_orm::{Database, DatabaseConnection, RelationTrait};
use seaography::{
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,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

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,3 +1,4 @@
use seaography::async_graphql;
use async_graphql::{dynamic::*, Response};
use sea_orm::Database;

Expand Down
5 changes: 3 additions & 2 deletions generator/src/templates/actix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ pub fn generate_main(crate_name: &str) -> TokenStream {

quote! {
use actix_web::{guard, web, web::Data, App, HttpResponse, HttpServer, Result};
use seaography::async_graphql;
use async_graphql::{
dynamic::*,
http::{playground_source, GraphQLPlaygroundConfig},
};
use async_graphql_actix_web::{GraphQLRequest, GraphQLResponse};
use dotenv::dotenv;
use lazy_static::lazy_static;
use seaography::lazy_static;
use sea_orm::Database;
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: 0 additions & 2 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"] }
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
5 changes: 3 additions & 2 deletions generator/src/templates/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub fn generate_main(crate_name: &str) -> TokenStream {
let crate_name_token: TokenStream = crate_name.replace('-', "_").parse().unwrap();

quote! {
use seaography::async_graphql;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql_axum::GraphQL;
use axum::{
Expand All @@ -18,12 +19,12 @@ pub fn generate_main(crate_name: &str) -> TokenStream {
Router,
};
use dotenv::dotenv;
use lazy_static::lazy_static;
use seaography::lazy_static;
use sea_orm::Database;
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: 0 additions & 2 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"] }
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
5 changes: 3 additions & 2 deletions generator/src/templates/poem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ pub fn generate_main(crate_name: &str) -> TokenStream {
let crate_name_token: TokenStream = crate_name.replace('-', "_").parse().unwrap();

quote! {
use seaography::async_graphql;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql_poem::GraphQL;
use dotenv::dotenv;
use lazy_static::lazy_static;
use seaography::lazy_static;
use poem::{get, handler, listener::TcpListener, web::Html, IntoResponse, Route, Server};
use sea_orm::Database;
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: 0 additions & 2 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"] }
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: 2 additions & 0 deletions generator/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ pub fn generate_query_root<P: AsRef<Path>>(entities_path: &P) -> TokenStream {

quote! {
use crate::entities::*;
use seaography::async_graphql;
use seaography::lazy_static;
use async_graphql::dynamic::*;
use sea_orm::DatabaseConnection;
use seaography::{Builder, BuilderContext};
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 a0a507b

Please sign in to comment.