Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加持久化层 #150

Merged
merged 39 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7016d8b
优化导入配置
Goodjooy Jul 23, 2023
3271954
:building_construction: 添加持久化包,用于全部持久化相关代码
Goodjooy Jul 23, 2023
c1d4012
:building_construction: 添加持久化包,用于全部持久化相关代码
Goodjooy Jul 23, 2023
44d3467
:sparkles: 添加 `persistence` crate 导出dao 等内容
Goodjooy Jul 23, 2023
8e23cde
:sparkles: 使用持久化导出
Goodjooy Jul 23, 2023
03c198f
:recycle: 部分替换为持久化导出
Goodjooy Jul 23, 2023
7ccc0c5
:recycle: 部分替换为持久化导出
Goodjooy Jul 23, 2023
96ae4d1
:recycle: 部分替换为持久化导出
Goodjooy Jul 23, 2023
533f8c8
:recycle: 将分离的model 和dao 从新组合
Goodjooy Jul 23, 2023
da75324
:recycle: 调整持久化导出
Goodjooy Jul 23, 2023
058f6f7
:recycle: 调整持久化导出
Goodjooy Jul 23, 2023
11dde46
:recycle: 去除不必要依赖
Goodjooy Jul 23, 2023
52dbbc8
:recycle: 修改 bakery logic 的持久化层依赖
Goodjooy Jul 23, 2023
6d7aa72
:recycle: 调整db-prelude feature
Goodjooy Jul 23, 2023
d6fdd7a
:recycle: 调整ceobe-cookie-logic 对持久层依赖
Goodjooy Jul 23, 2023
e41e32f
:recycle: 调整ceobe-user-logic 对持久层依赖
Goodjooy Jul 23, 2023
230d212
:recycle: 调整fetcher-logic 对持久层依赖
Goodjooy Jul 23, 2023
5eb0b96
:recycle: 去除对migrate直接依赖
Goodjooy Jul 23, 2023
33a079e
:art: cargo fmt
Goodjooy Jul 23, 2023
dff3cc5
:rewind: 撤销对proto 的修改
Goodjooy Jul 23, 2023
762fd8b
✨ 去除遗漏的持久层直接依赖
Goodjooy Jul 23, 2023
9b44404
:art: 去除不必要re-export
Goodjooy Jul 23, 2023
c8757e6
:art: 去除不必要re-export
Goodjooy Jul 23, 2023
0996d10
:art: 格式化代码
Goodjooy Jul 23, 2023
d6c1886
Merge branch 'master' into grouped-dbcodes
Goodjooy Jul 23, 2023
843ee34
:recycle: 将时间相关代码独立为一个crate
Goodjooy Jul 23, 2023
595aab1
:recycle: 将原本sql-model 导出的接口移动到 sql_connection
Goodjooy Jul 23, 2023
418178d
:recycle: 添加根据feature 专用接口
Goodjooy Jul 23, 2023
f79132c
:recycle: 使用sql 的time-utils feature
Goodjooy Jul 23, 2023
8c95229
:recycle: 将在 mongo-models 中导出的 `RecordUnit` 移动到 `mongo_connection`
Goodjooy Jul 23, 2023
35a38ba
:recycle: 配置 `persistence` 中的 `time-utils` 的 features
Goodjooy Jul 23, 2023
563f81d
:recycle: 将 `sql-migration` 的 时间相关接口更换为 `time-utils` 中的接口
Goodjooy Jul 23, 2023
90593dc
:recycle: 调整 `db-ops-prelude` 中导出
Goodjooy Jul 23, 2023
7717810
:recycle: 修复调整 `db-ops-prelude` 中导出后出现错误
Goodjooy Jul 23, 2023
8261e87
:art: cargo fmt
Goodjooy Jul 23, 2023
a8d44cb
:art: cargo fmt
Goodjooy Jul 23, 2023
bbc4525
Merge remote-tracking branch 'origin/grouped-dbcodes' into grouped-db…
Goodjooy Jul 23, 2023
6df1973
:bug: fix feature 遗漏
Goodjooy Jul 24, 2023
560d06e
:art: cargo fmt
Goodjooy Jul 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 5 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ strip = true
[workspace]
members = [
"libs/*",
"./models/*",
"./migrate/*",
"./database/*",
"persistence/persistence",
"./macros/*",
"./middle-server/*",
"./logic/*",
"./global/*",
"./dao/*",
"./service/*"
]

Expand Down Expand Up @@ -76,23 +73,17 @@ redis = { version = "0.22", features = [
] }
general-request-client = { path = "./middle-server/general-request-client" }
scheduler-notifier = { version = "0.1.0", path = "middle-server/scheduler-notifier" }
db-ops-prelude = { version = "0.1.0", path = "database/db-ops-prelude" }
db-ops-prelude = { version = "0.1.0", path = "persistence/database/db-ops-prelude" }
bool_or = {version = "0.1.0", path = "./libs/bool_or"}
abstract_database = { version = "0.1.0", path = "database/abstract_database" }
ceobe-user = { version = "0.1.0", path = "dao/ceobe-user" }
ceobe-operate = { version = "0.1.0", path = "dao/ceobe-operate" }
fetcher = { version = "0.1.0", path = "dao/fetcher" }
bakery = { version = "0.1.0", path = "dao/bakery" }
admin = { version = "0.1.0", path = "dao/admin" }
ceobe-cookie = { version = "0.1.0", path = "dao/ceobe-cookie" }
abstract_database = { version = "0.1.0", path = "persistence/database/abstract_database" }
page_size = { version = "0.1.0", path = "./libs/page_size" }
mysql_func = { version = "0.1.0", path = "./libs/mysql_func" }
bitmap-convert = { version = "0.1.0", path = "./libs/bitmap-convert" }
bitmaps = "3.2.0"
qiniu-cdn-upload = { version = "0.1.0", path = "middle-server/qiniu-cdn-upload" }
mob-push-server = { version = "0.1.0", path = "middle-server/mob-push-server" }
qiniu_service = { version = "0.1.0", path = "service/qiniu_service" }

persistence = { version = "0.1.0", path = "persistence/persistence" }

[dependencies]
# Xss
Expand Down Expand Up @@ -145,19 +136,14 @@ uuid = { version = "1.2.2", features = ["v4"] }
request-clients = { version = "0.1.0", path = "middle-server/request-clients" }
general-request-client.workspace = true
scheduler-notifier.workspace = true
ceobe-operate.workspace = true
bool_or.workspace = true
ceobe-user.workspace = true
page_size.workspace = true
fetcher.workspace = true
bakery.workspace = true
admin.workspace = true
ceobe-cookie.workspace = true
qiniu-cdn-upload.workspace = true
mob-push-server.workspace = true
qq-channel-warning = { version = "0.1.0", path = "middle-server/qq-channel-warning" }
bitmap-convert.workspace = true
bitmaps.workspace = true
persistence = { workspace = true, features = ["prelude", "migrate"] }

[dependencies.tokio]
workspace = true
Expand Down Expand Up @@ -187,21 +173,11 @@ workspace = true
[dependencies.checker]
path = "./libs/checker"

[dependencies.orm-migrate]
package = "migration"
path = "./migrate/sql-migration"

[dependencies.mongo-migration]
path = "./migrate/mongo-migration"

[dependencies.modify-cache]
path = "./libs/modify-cache"

[dependencies.database_traits]
path = "./database/database_traits"

[dependencies.redis_connection]
path = "./database/redis_connection"

[dependencies.fetcher_logic]
path = "./logic/fetcher_logic"
Expand Down
2 changes: 1 addition & 1 deletion assets/proto
Submodule proto updated 1 files
+1 −1 protos/log.proto
18 changes: 9 additions & 9 deletions libs/checker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
mod check_fut;
mod check_prehandle;
mod checker;
mod checker_impls;
mod codegen;
mod lite_args;
pub mod prefabs;
mod require_check;

pub use check_fut::CheckFut;
pub use check_obj_macro::{check_obj, check_obj as check_gen};
pub use check_prehandle::{
Expand All @@ -19,5 +10,14 @@ pub use require_check::{CheckRequire, ToCheckRequire};

pub use crate::checker::{Checker, LiteChecker, RefChecker};

mod check_fut;
mod check_prehandle;
mod checker;
mod checker_impls;
mod codegen;
mod lite_args;
pub mod prefabs;
mod require_check;

pub type Checked<C> = <C as Checker>::Checked;
pub type Uncheck<C> = <C as Checker>::Unchecked;
1 change: 1 addition & 0 deletions libs/checker/src/prefabs/collect_checkers/slice_checker.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]

use std::{fmt::Debug, marker::PhantomData, pin::Pin, task::Poll};

use futures::Future;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]

use std::{
convert::Infallible,
marker::PhantomData,
Expand Down
1 change: 1 addition & 0 deletions libs/checker/src/prefabs/post_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use futures::{ready, Future};
use pin_project::pin_project;

use crate::Checker;

/// 追加checker
///
/// 执行完成 `C::check` 后使用 `P::ref_check` 进行追加checker
Expand Down
1 change: 1 addition & 0 deletions libs/crypto_str/src/encoders/bcrypt.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::borrow::Cow;

use crate::Encoder;

#[derive(Default, Debug, Clone)]
pub struct BcryptEncoder<const COST: u32>;

Expand Down
15 changes: 9 additions & 6 deletions libs/crypto_str/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
pub use crypto::CryptoString;
pub use encoders::Encoder;
#[cfg(feature = "wrap")]
pub use wrap::{Crypto, CryptoWarp, Raw};

mod crypto;
mod encoders;
#[cfg(feature = "serde")] mod serde;
#[cfg(feature = "trans")] mod trans;
#[cfg(feature = "wrap")] mod wrap;

pub use encoders::Encoder;
pub mod inner_encoders {
#[cfg(feature = "bcrypt")]
pub mod bcrypt {
pub use bcrypt_::BcryptError;

pub use crate::encoders::bcrypt::BcryptEncoder;

pub type DefaultBcryptEncoder = BcryptEncoder<12>;
pub type BcryptString = crate::CryptoString<DefaultBcryptEncoder>;
pub use bcrypt_::BcryptError;
}

#[cfg(feature = "none")]
pub mod none {
pub use crate::encoders::none::NoCrypto;

pub type NoCrtpyoString = crate::CryptoString<NoCrypto>;
}
}

pub use crypto::CryptoString;
#[cfg(feature = "wrap")]
pub use wrap::{Crypto, CryptoWarp, Raw};
7 changes: 4 additions & 3 deletions libs/logger/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
mod error;
mod log_init;
mod log_to;
pub use error::Error;
pub use log_init::{GetLogLevel, LogInit};
pub use log_to::{
file::{FileLoggerInfo, LogToFile},
stdout::LogToStdout,
};

mod error;
mod log_init;
mod log_to;

#[cfg(test)]
mod test {
use tracing::{debug, error, info, trace, warn};
Expand Down
1 change: 1 addition & 0 deletions libs/logger/src/log_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use tracing_subscriber::{
};

use crate::{LogToFile, LogToStdout};

pub struct LogInit<S>(S);
pub trait GetLogLevel {
fn get_level(&self) -> LevelFilter { LevelFilter::TRACE }
Expand Down
1 change: 0 additions & 1 deletion libs/modify-cache/src/cache_ctrl/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ impl<'c> Add<&'c CacheControl> for ExtraFlags {

#[cfg(test)]
mod test {

use std::time::Duration;

use super::CacheControl;
Expand Down
4 changes: 3 additions & 1 deletion libs/modify-cache/src/cache_ctrl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod control;
use std::{borrow::Cow, ops::Add};

use http::{
Expand All @@ -8,6 +7,9 @@ use http::{
use resp_result::{ExtraFlag, ExtraFlags};

use self::control::CacheControl;

pub mod control;

#[derive(Debug, Default)]
pub struct CacheHeaders {
pub(crate) content_local: Option<Uri>,
Expand Down
16 changes: 8 additions & 8 deletions libs/modify-cache/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
mod cache_ctrl;
mod check_modify;
mod encode;
mod error;
mod headers;
mod time_format;
mod traits;

pub use cache_ctrl::{
control::{CacheControl, CacheMode, Revalidate, Transform},
CacheHeaders,
};
pub use check_modify::CheckModify;
pub use error::Error;
pub use traits::{CacheState, ModifyState};

mod cache_ctrl;
mod check_modify;
mod encode;
mod error;
mod headers;
mod time_format;
mod traits;
10 changes: 5 additions & 5 deletions libs/mongo-migrate-util/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mod collect_manage;
mod manager;
mod migration;
mod migrator;

pub use collect_manage::CollectManage;
pub use manager::Manager;
pub use migration::MigrationTrait;
pub use migrator::{DbManager, MigratorTrait};

mod collect_manage;
mod manager;
mod migration;
mod migrator;
1 change: 1 addition & 0 deletions libs/qiniu-manager/examples/server-uploader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use ceobe_qiniu_upload::{
};
use log::SetLoggerError;
use url::Url;

#[tokio::main]
async fn main() {
let path = std::fs::read_to_string("./qiniu_example.json")
Expand Down
1 change: 1 addition & 0 deletions libs/qiniu-manager/src/axum_starter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl QiniuManager {
#[cfg(test)]
mod test {
use url::Url;

#[test]
fn test_url_concat() {
let mut url = Url::parse("https://example.net").unwrap();
Expand Down
1 change: 1 addition & 0 deletions libs/qiniu-manager/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use axum::extract::multipart::MultipartError;
use qiniu_upload_manager::apis::http_client::ResponseError;
use status_err::ErrPrefix;

#[derive(Debug, thiserror::Error, status_err::StatusErr)]
pub enum Error {
#[error(transparent)]
Expand Down
12 changes: 6 additions & 6 deletions libs/qiniu-manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
mod axum_starter;
mod error;

mod config;
mod manager;

pub use config::{BaseUrl, GetBucket, SecretConfig};
pub use error::{Error, UploaderNotFound};
pub use manager::{
Expand All @@ -17,3 +11,9 @@ pub use mime_guess;
pub use crate::axum_starter::{
QiniuBaseUrl, QiniuManager, QiniuUpload, QiniuUploadState,
};

mod axum_starter;
mod error;

mod config;
mod manager;
8 changes: 5 additions & 3 deletions libs/qiniu-manager/src/manager/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
mod builder;
pub mod delete;
pub mod upload;
use std::fmt::Debug;

use qiniu_objects_manager::Bucket;
Expand All @@ -13,6 +10,11 @@ pub use self::{
},
};
use crate::SecretConfig;

mod builder;
pub mod delete;
pub mod upload;

#[derive(Debug)]
pub struct Manager {
pub(crate) uploader: ManagedUploader,
Expand Down
8 changes: 4 additions & 4 deletions libs/range-limit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod error;
pub mod measurable;
pub mod range_limit;

pub use crate::{
error::Error,
range_limit::{limits, range_limit_core::RangeBoundLimit, RangeBound},
};

mod error;
pub mod measurable;
pub mod range_limit;
4 changes: 3 additions & 1 deletion libs/status-err/examples/code_gen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use status_err::{ErrPrefix, HttpCode, StatusErr};

fn main() {
let e = TestErr::Else {
start: String::from("Abc"),
Expand All @@ -6,7 +8,7 @@ fn main() {
println!("{}", e.information());
println!("{}", e.respond_msg())
}
use status_err::{ErrPrefix, HttpCode, StatusErr};

#[derive(Debug, status_err::ThisError, status_err::StatusErr)]
#[status_err(resp_err)]
pub enum TestErr {
Expand Down
Loading
Loading