feophantlib/engine/
test_objects.rs

1//! Set of functions used for unit testing instead of copying them everywhere
2
3use super::objects::{SqlTuple, Table};
4use crate::{
5    constants::Nullable,
6    engine::objects::{
7        types::{BaseSqlTypes, BaseSqlTypesMapper},
8        Attribute,
9    },
10};
11use std::sync::Arc;
12
13pub fn get_row(input: String) -> SqlTuple {
14    SqlTuple(vec![
15            Some(BaseSqlTypes::Text(input)),
16            None,
17            Some(BaseSqlTypes::Text("blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah".to_string())),
18        ])
19}
20
21pub fn get_table() -> Arc<Table> {
22    Arc::new(Table::new(
23        uuid::Uuid::new_v4(),
24        "test_table".to_string(),
25        vec![
26            Attribute::new(
27                "header".to_string(),
28                BaseSqlTypesMapper::Text,
29                Nullable::NotNull,
30                None,
31            ),
32            Attribute::new(
33                "id".to_string(),
34                BaseSqlTypesMapper::Uuid,
35                Nullable::Null,
36                None,
37            ),
38            Attribute::new(
39                "header3".to_string(),
40                BaseSqlTypesMapper::Text,
41                Nullable::NotNull,
42                None,
43            ),
44        ],
45        vec![],
46        vec![],
47    ))
48}