forked from Txio-labs/txio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpc.rs
More file actions
30 lines (28 loc) · 775 Bytes
/
Copy pathrpc.rs
File metadata and controls
30 lines (28 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use serde::{Deserialize, Serialize};
use mongodb::bson::oid::ObjectId;
use chrono::{DateTime, Utc};
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct RpcLog {
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub id: Option<ObjectId>,
pub user_id: ObjectId,
pub method: String,
pub params: Value,
pub timestamp: DateTime<Utc>,
pub success: bool,
pub error: Option<String>,
}
impl RpcLog {
pub fn new(user_id: ObjectId, method: String, params: Value, success: bool, error: Option<String>) -> Self {
Self {
id: None,
user_id,
method,
params,
timestamp: Utc::now(),
success,
error,
}
}
}