toasty_core/stmt/
values.rs1use super::{Expr, ExprSet, Query};
2
3#[derive(Debug, Default, Clone, PartialEq)]
5pub struct Values {
6 pub rows: Vec<Expr>,
7}
8
9impl Values {
10 pub fn new(rows: Vec<Expr>) -> Self {
11 Self { rows }
12 }
13
14 pub fn is_empty(&self) -> bool {
15 self.rows.is_empty()
16 }
17
18 pub fn is_const(&self) -> bool {
19 self.rows.iter().all(|row| row.is_const())
20 }
21}
22
23impl From<Values> for ExprSet {
24 fn from(value: Values) -> Self {
25 Self::Values(value)
26 }
27}
28
29impl From<Values> for Query {
30 fn from(value: Values) -> Self {
31 Self::builder(value).build()
32 }
33}
34
35impl From<Expr> for Values {
36 fn from(value: Expr) -> Self {
37 Self { rows: vec![value] }
38 }
39}