mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
## Why Row derives and migration embedding do not need query macros or a host SQLite driver. ## What changed - Remove the `macros` feature from `sqlx` and depend directly on `sqlx-macros` with only `derive` and `migrate` enabled. - Update state and thread-store derives and migration embedding to use `sqlx_macros`. - Enable `sqlx-sqlite`'s `offline` feature directly to preserve query-description support in the target driver. - Pin `sqlx`, `sqlx-macros`, and `sqlx-sqlite` to `=0.9.0` to keep their versions aligned. GitOrigin-RevId: 8a8ef691ff2862a7dad978a578c5206b52dfc0b6
58 lines
1.6 KiB
Rust
58 lines
1.6 KiB
Rust
use serde::Serialize;
|
|
use sqlx_macros::FromRow;
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
pub struct LogEntry {
|
|
pub ts: i64,
|
|
pub ts_nanos: i64,
|
|
pub level: String,
|
|
pub target: String,
|
|
pub message: Option<String>,
|
|
pub feedback_log_body: Option<String>,
|
|
pub thread_id: Option<String>,
|
|
pub process_uuid: Option<String>,
|
|
pub module_path: Option<String>,
|
|
pub file: Option<String>,
|
|
pub line: Option<i64>,
|
|
}
|
|
|
|
impl LogEntry {
|
|
pub(crate) fn estimated_bytes(&self) -> i64 {
|
|
let feedback_log_body = self.feedback_log_body.as_ref().or(self.message.as_ref());
|
|
feedback_log_body.map_or(0, String::len) as i64
|
|
+ self.level.len() as i64
|
|
+ self.target.len() as i64
|
|
+ self.module_path.as_ref().map_or(0, String::len) as i64
|
|
+ self.file.as_ref().map_or(0, String::len) as i64
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Debug, FromRow)]
|
|
pub struct LogRow {
|
|
pub id: i64,
|
|
pub ts: i64,
|
|
pub ts_nanos: i64,
|
|
pub level: String,
|
|
pub target: String,
|
|
pub message: Option<String>,
|
|
pub thread_id: Option<String>,
|
|
pub process_uuid: Option<String>,
|
|
pub file: Option<String>,
|
|
pub line: Option<i64>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default)]
|
|
pub struct LogQuery {
|
|
pub levels_upper: Vec<String>,
|
|
pub from_ts: Option<i64>,
|
|
pub to_ts: Option<i64>,
|
|
pub module_like: Vec<String>,
|
|
pub file_like: Vec<String>,
|
|
pub thread_ids: Vec<String>,
|
|
pub search: Option<String>,
|
|
pub include_threadless: bool,
|
|
pub after_id: Option<i64>,
|
|
pub limit: Option<usize>,
|
|
pub descending: bool,
|
|
}
|