1
0
dust/examples/table.ds

44 lines
686 B
Plaintext
Raw Normal View History

2023-10-21 17:04:17 +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-10-21 17:04:17 +00:00
test_table = table <text bool> [
["a", true]
["b", true]
["a", true]
]
2023-10-06 12:17:37 +00:00
2023-10-21 17:04:17 +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-10-21 17:04:17 +00:00
test_table = table <text number bool> [
[1, true]
[3, true]
]
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)
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)