1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use google_api_proto::google::firestore::v1::structured_query;

use crate::FieldPath;

pub struct Order(structured_query::Order);

impl Order {
    pub(crate) fn new(field_path: FieldPath, direction: structured_query::Direction) -> Self {
        Self(structured_query::Order {
            field: Some(structured_query::FieldReference::from(field_path)),
            direction: direction as i32,
        })
    }
}

impl std::convert::From<Order> for structured_query::Order {
    fn from(order: Order) -> Self {
        order.0
    }
}