| 86 | self.distinct_union |
| 87 | } |
| 88 | pub fn build(&self) -> Result<ast::Query, BuilderError> { |
| 89 | let order_by = self |
| 90 | .order_by_kind |
| 91 | .as_ref() |
| 92 | .map(|order_by_kind| ast::OrderBy { |
| 93 | kind: order_by_kind.clone(), |
| 94 | interpolate: None, |
| 95 | }); |
| 96 | |
| 97 | Ok(ast::Query { |
| 98 | with: self.with.clone(), |
| 99 | body: match self.body { |
| 100 | Some(ref value) => value.clone(), |
| 101 | None => return Err(Into::into(UninitializedFieldError::from("body"))), |
| 102 | }, |
| 103 | order_by, |
| 104 | limit_clause: Some(LimitClause::LimitOffset { |
| 105 | limit: self.limit.clone(), |
| 106 | offset: self.offset.clone(), |
| 107 | limit_by: self.limit_by.clone(), |
| 108 | }), |
| 109 | fetch: self.fetch.clone(), |
| 110 | locks: self.locks.clone(), |
| 111 | for_clause: self.for_clause.clone(), |
| 112 | settings: None, |
| 113 | format_clause: None, |
| 114 | pipe_operators: vec![], |
| 115 | }) |
| 116 | } |
| 117 | fn create_empty() -> Self { |
| 118 | Self { |
| 119 | with: Default::default(), |