blob: 3893254c1c4d02e8aa00aae99b962e692dbf8c63 (
plain)
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
31
32
33
34
35
|
pub mod create;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use crate::ConfigurationError;
/// Transaction to monitor
#[derive(Deserialize, Serialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct TransactionSchema {
#[serde(rename = "type")]
/// Transaction schema type
pub kind: String,
/// The schema's version
pub version: String,
/// JSON schema for transcation
#[serde(rename = "json_schema")]
pub schema: serde_json::Value,
#[serde(with = "time::serde::rfc3339")]
pub created_at: OffsetDateTime,
#[serde(with = "time::serde::rfc3339")]
pub updated_at: OffsetDateTime,
}
#[async_trait]
pub trait SchemaDriver {
async fn create_schema(
&self,
name: impl AsRef<str> + Send + Sync,
version: impl AsRef<str> + Send + Sync,
schema: &serde_json::Value,
) -> Result<TransactionSchema, ConfigurationError>;
}
|