Examples: entity & application crate depends on SeaORM with minimum required features enabled (#723)

This commit is contained in:
Billy Chan 2022-05-14 13:24:39 +08:00 committed by GitHub
parent b59f3c58de
commit c3db8f4b65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 101 additions and 103 deletions

View File

@ -22,3 +22,14 @@ serde = "1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
entity = { path = "entity" }
migration = { path = "migration" }
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"debug-print",
"runtime-async-std-native-tls",
"sqlx-mysql",
# "sqlx-postgres",
# "sqlx-sqlite",
]

View File

@ -6,7 +6,7 @@
1. Modify the `DATABASE_URL` var in `.env` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-mysql",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-mysql",` line)
1. Execute `cargo run` to start the server

View File

@ -14,11 +14,3 @@ serde = { version = "1", features = ["derive"] }
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"debug-print",
"runtime-async-std-native-tls",
"sqlx-mysql",
# "sqlx-postgres",
# "sqlx-sqlite",
]

View File

@ -1,3 +1 @@
pub mod post;
pub use sea_orm;

View File

@ -5,7 +5,6 @@ use actix_web::{
use entity::post;
use entity::post::Entity as Post;
use entity::sea_orm;
use listenfd::ListenFd;
use migration::{Migrator, MigratorTrait};
use sea_orm::DatabaseConnection;

View File

@ -22,3 +22,14 @@ serde = "1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
entity = { path = "entity" }
migration = { path = "migration" }
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"debug-print",
"runtime-actix-native-tls",
"sqlx-mysql",
# "sqlx-postgres",
# "sqlx-sqlite",
]

View File

@ -4,7 +4,7 @@
1. Modify the `DATABASE_URL` var in `.env` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-mysql",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-mysql",` line)
1. Execute `cargo run` to start the server

View File

@ -14,11 +14,3 @@ serde = { version = "1", features = ["derive"] }
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"debug-print",
"runtime-actix-native-tls",
"sqlx-mysql",
# "sqlx-postgres",
# "sqlx-sqlite",
]

View File

@ -1,3 +1 @@
pub mod post;
pub use sea_orm;

View File

@ -5,7 +5,6 @@ use actix_web::{
use entity::post;
use entity::post::Entity as Post;
use entity::sea_orm;
use listenfd::ListenFd;
use migration::{Migrator, MigratorTrait};
use sea_orm::DatabaseConnection;

View File

@ -23,3 +23,14 @@ tera = "1.15.0"
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
entity = { path = "entity" }
migration = { path = "migration" }
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"debug-print",
"runtime-tokio-native-tls",
"sqlx-postgres",
# "sqlx-mysql",
# "sqlx-sqlite",
]

View File

@ -4,7 +4,7 @@
1. Modify the `DATABASE_URL` var in `.env` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-postgres",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-postgres",` line)
1. Execute `cargo run` to start the server

View File

@ -14,11 +14,3 @@ serde = { version = "1", features = ["derive"] }
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"debug-print",
"runtime-tokio-native-tls",
"sqlx-postgres",
# "sqlx-mysql",
# "sqlx-sqlite",
]

View File

@ -1,3 +1 @@
pub mod post;
pub use sea_orm;

View File

@ -8,7 +8,6 @@ use axum::{
Router, Server,
};
use entity::post;
use entity::sea_orm;
use flash::{get_flash_cookie, post_response, PostResponse};
use migration::{Migrator, MigratorTrait};
use post::Entity as Post;

View File

@ -16,3 +16,13 @@ dotenv = "0.15.0"
async-graphql-axum = "^3.0.38"
entity = { path = "entity" }
migration = { path = "migration" }
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"runtime-tokio-native-tls",
# "sqlx-postgres",
# "sqlx-mysql",
"sqlx-sqlite"
]

View File

@ -6,7 +6,7 @@
1. Modify the `DATABASE_URL` var in `.env` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-sqlite",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-sqlite",` line)
1. Execute `cargo run` to start the server

View File

@ -17,10 +17,3 @@ version = "^3.0.38"
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"runtime-tokio-native-tls",
# "sqlx-postgres",
# "sqlx-mysql",
"sqlx-sqlite"
]

View File

@ -1,4 +1,3 @@
pub mod note;
pub use async_graphql;
pub use sea_orm;

View File

@ -1,8 +1,6 @@
use entity::note;
use sea_orm::{DbBackend, EntityTrait, Schema};
use sea_orm_migration::prelude::*;
use entity::{
note,
sea_orm::{DbBackend, EntityTrait, Schema},
};
pub struct Migration;

View File

@ -1,4 +1,3 @@
use entity::sea_orm;
use sea_orm::DatabaseConnection;
pub struct Database {

View File

@ -1,7 +1,7 @@
use async_graphql::{Context, Object, Result};
use entity::async_graphql::{self, InputObject, SimpleObject};
use entity::note;
use entity::sea_orm::{ActiveModelTrait, Set};
use sea_orm::{ActiveModelTrait, Set};
use crate::db::Database;

View File

@ -1,5 +1,6 @@
use async_graphql::{Context, Object, Result};
use entity::{async_graphql, note, sea_orm::EntityTrait};
use entity::{async_graphql, note};
use sea_orm::EntityTrait;
use crate::db::Database;

View File

@ -19,4 +19,15 @@ migration = { path = "migration" }
anyhow = "1.0.52"
async-trait = "0.1.52"
log = { version = "0.4", features = ["std"] }
simplelog = "*"
simplelog = "*"
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"debug-print",
"runtime-tokio-native-tls",
"sqlx-sqlite",
# "sqlx-postgres",
# "sqlx-mysql",
]

View File

@ -2,7 +2,7 @@
1. Modify the `DATABASE_URL` var in `.env` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-sqlite",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-sqlite",` line)
1. Execute `cargo run` to start the server

View File

@ -14,11 +14,3 @@ serde = { version = "1", features = ["derive"] }
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"debug-print",
"runtime-tokio-native-tls",
"sqlx-sqlite",
# "sqlx-postgres",
# "sqlx-mysql",
]

View File

@ -1,3 +1 @@
pub mod post;
pub use sea_orm;

View File

@ -2,7 +2,6 @@ use std::env;
use anyhow::anyhow;
use entity::post;
use entity::sea_orm;
use jsonrpsee::core::{async_trait, RpcResult};
use jsonrpsee::http_server::HttpServerBuilder;
use jsonrpsee::proc_macros::rpc;

View File

@ -16,3 +16,14 @@ tera = "1.8.0"
dotenv = "0.15"
entity = { path = "entity" }
migration = { path = "migration" }
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"debug-print",
"runtime-tokio-native-tls",
"sqlx-sqlite",
# "sqlx-postgres",
# "sqlx-mysql",
]

View File

@ -4,7 +4,7 @@
1. Modify the `DATABASE_URL` var in `.env` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-sqlite",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-sqlite",` line)
1. Execute `cargo run` to start the server

View File

@ -14,11 +14,3 @@ serde = { version = "1", features = ["derive"] }
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"debug-print",
"runtime-tokio-native-tls",
"sqlx-sqlite",
# "sqlx-postgres",
# "sqlx-mysql",
]

View File

@ -1,3 +1 @@
pub mod post;
pub use sea_orm;

View File

@ -1,7 +1,6 @@
use std::env;
use entity::post;
use entity::sea_orm;
use migration::{Migrator, MigratorTrait};
use poem::endpoint::StaticFilesEndpoint;
use poem::error::{BadRequest, InternalServerError};

View File

@ -26,3 +26,13 @@ migration = { path = "migration" }
[dependencies.sea-orm-rocket]
path = "../../sea-orm-rocket/lib" # remove this line in your own project and use the git line
# git = "https://github.com/SeaQL/sea-orm"
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"runtime-tokio-native-tls",
"sqlx-postgres",
# "sqlx-mysql",
# "sqlx-sqlite",
]

View File

@ -4,7 +4,7 @@
1. Modify the `url` var in `Rocket.toml` to point to your chosen database
1. Turn on the appropriate database feature for your chosen db in `entity/Cargo.toml` (the `"sqlx-postgres",` line)
1. Turn on the appropriate database feature for your chosen db in `Cargo.toml` (the `"sqlx-postgres",` line)
1. Execute `cargo run` to start the server

View File

@ -16,10 +16,3 @@ rocket = { version = "0.5.0-rc.1", features = [
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"runtime-tokio-native-tls",
"sqlx-postgres",
# "sqlx-mysql",
# "sqlx-sqlite",
]

View File

@ -2,5 +2,3 @@
extern crate rocket;
pub mod post;
pub use sea_orm;

View File

@ -10,7 +10,6 @@ use rocket::{Build, Request, Rocket};
use rocket_dyn_templates::Template;
use serde_json::json;
use entity::sea_orm;
use migration::MigratorTrait;
use sea_orm::{entity::*, query::*};
use sea_orm_rocket::{Connection, Database};

View File

@ -1,5 +1,4 @@
use async_trait::async_trait;
use entity::sea_orm;
use sea_orm::ConnectOptions;
use sea_orm_rocket::{rocket::figment::Figment, Config, Database};
use std::time::Duration;

View File

@ -17,6 +17,17 @@ migration = { path = "migration" }
prost = "0.10.0"
serde = "1.0"
[dependencies.sea-orm]
path = "../../" # remove this line in your own project
version = "^0.8.0"
features = [
"debug-print",
"runtime-tokio-rustls",
# "sqlx-mysql",
"sqlx-postgres",
# "sqlx-sqlite",
]
[lib]
path = "./src/lib.rs"

View File

@ -14,11 +14,3 @@ serde = { version = "1", features = ["derive"] }
[dependencies.sea-orm]
path = "../../../" # remove this line in your own project
version = "^0.8.0"
features = [
"macros",
"debug-print",
"runtime-tokio-rustls",
# "sqlx-mysql",
"sqlx-postgres",
# "sqlx-sqlite",
]

View File

@ -1,3 +1 @@
pub mod post;
pub use sea_orm;

View File

@ -6,11 +6,9 @@ use sea_orm_tonic_example::post::{
Post, PostId, PostList, PostPerPage, ProcessStatus,
};
use entity::{
post::{self, Entity as PostEntity},
sea_orm::{self, entity::*, query::*, DatabaseConnection},
};
use entity::post::{self, Entity as PostEntity};
use migration::{Migrator, MigratorTrait};
use sea_orm::{self, entity::*, query::*, DatabaseConnection};
use std::env;