1
0
dust/examples/table.ds

44 lines
682 B
Plaintext
Raw Permalink Normal View History

2023-11-03 22:04:45 +00:00
my_table = table |text number bool| [
["a", 1, true]
["b", 2, true]
["a", 3, true]
]
2023-10-06 12:17:37 +00:00
2023-11-03 22:04:45 +00:00
test_table = table |text bool| [
["a", true]
["b", true]
["a", true]
]
2023-10-06 12:17:37 +00:00
2023-11-04 10:02:27 +00:00
test_select = select |text bool| from my_table;
2023-10-06 12:17:37 +00:00
2023-10-21 17:04:17 +00:00
(assert_equal test_select, test_table)
2023-10-06 12:17:37 +00:00
2023-11-04 10:02:27 +00:00
test_table = table |number bool| [
[1, true]
[3, true]
]
2023-11-03 22:04:45 +00:00
test_select_where = select |number, bool| from my_table {
2023-10-21 17:04:17 +00:00
text == "a"
}
2023-10-21 17:04:17 +00:00
(assert_equal test_select_where, test_table)
2023-11-03 22:04:45 +00:00
test_table = table |text number bool| [
["a", 1, true]
["b", 2, true]
["a", 3, true]
["c", 4, true]
["d", 5, true]
["e", 6, true]
]
insert into my_table [
["c", 4, true]
["d", 5, true]
["e", 6, true]
]
(assert_equal test_table, my_table)