Skip to main content

sea_query/value/
postgres_range.rs

1use super::*;
2use crate::IntoIden;
3
4impl From<RangeType> for Value {
5    fn from(x: RangeType) -> Value {
6        Value::Range(Some(x.into()))
7    }
8}
9
10impl Nullable for RangeType {
11    fn null() -> Value {
12        Value::Range(None)
13    }
14}
15
16impl ValueType for RangeType {
17    fn try_from(v: Value) -> Result<Self, ValueTypeErr> {
18        match v {
19            Value::Range(Some(x)) => Ok(*x),
20            _ => Err(ValueTypeErr),
21        }
22    }
23
24    fn type_name() -> String {
25        stringify!(RangeType).to_owned()
26    }
27
28    fn array_type() -> ArrayType {
29        ArrayType::Range
30    }
31
32    fn column_type() -> ColumnType {
33        ColumnType::Custom("RANGE".into_iden())
34    }
35}