Skip to main content

interstice_abi/schema/
reducer.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{IntersticeType, SubscriptionEventSchema, interstice_type_def::FieldDef};
4
5#[derive(Debug, Clone, Deserialize, Serialize)]
6pub struct ReducerSchema {
7    pub name: String,
8    pub arguments: Vec<FieldDef>,
9    pub return_type: IntersticeType,
10}
11
12impl ReducerSchema {
13    pub fn new(
14        name: impl Into<String>,
15        arguments: Vec<FieldDef>,
16        return_type: IntersticeType,
17    ) -> Self {
18        Self {
19            name: name.into(),
20            arguments,
21            return_type,
22        }
23    }
24}
25
26#[derive(Debug, Clone, Deserialize, Serialize)]
27pub struct SubscriptionSchema {
28    pub reducer_name: String,
29    pub event: SubscriptionEventSchema,
30}