1
0
forked from Eeveid/lightOps

实现 LightOps 运维面板基础功能

This commit is contained in:
2026-05-25 01:13:03 +08:00
commit d3bb9f45a6
84 changed files with 23505 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize)]
pub struct ApiResponse<T>
where
T: Serialize,
{
pub success: bool,
pub data: Option<T>,
pub error: Option<String>,
}
impl<T> ApiResponse<T>
where
T: Serialize,
{
pub fn ok(data: T) -> Self {
Self {
success: true,
data: Some(data),
error: None,
}
}
}
impl ApiResponse<()> {
pub fn empty() -> Self {
Self {
success: true,
data: Some(()),
error: None,
}
}
pub fn err(message: impl Into<String>) -> Self {
Self {
success: false,
data: None,
error: Some(message.into()),
}
}
}
#[derive(Debug, Deserialize)]
pub struct PageQuery {
pub limit: Option<i64>,
pub offset: Option<i64>,
}