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
pub mod custom_types {
    use query_structure::PrismaValue;

    pub const TYPE: &str = "$type";
    pub const VALUE: &str = "value";

    pub const DATETIME: &str = "DateTime";
    pub const BIGINT: &str = "BigInt";
    pub const DECIMAL: &str = "Decimal";
    pub const BYTES: &str = "Bytes";
    pub const JSON: &str = "Json";
    pub const ENUM: &str = "Enum";
    pub const FIELD_REF: &str = "FieldRef";
    pub const RAW: &str = "Raw";

    pub fn make_object(typ: &str, value: PrismaValue) -> PrismaValue {
        PrismaValue::Object(vec![make_type_pair(typ), make_value_pair(value)])
    }

    fn make_type_pair(typ: &str) -> (String, PrismaValue) {
        (TYPE.to_string(), PrismaValue::String(typ.to_string()))
    }

    fn make_value_pair(value: PrismaValue) -> (String, PrismaValue) {
        (VALUE.to_string(), value)
    }
}