forked from fnc12/sqlite_orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex_tests.cpp
More file actions
47 lines (44 loc) · 1.48 KB
/
index_tests.cpp
File metadata and controls
47 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <sqlite_orm/sqlite_orm.h>
#include <catch2/catch.hpp>
using namespace sqlite_orm;
TEST_CASE("index") {
struct User {
int id = 0;
std::string name;
};
auto table = make_table("users", make_column("id", &User::id), make_column("name", &User::name));
{
auto storage = make_storage({}, make_index("id_index", &User::id), table);
storage.sync_schema();
}
{
auto storage = make_storage({}, make_index("id_index", indexed_column(&User::id).asc()), table);
storage.sync_schema();
}
{
auto storage = make_storage({}, make_index("id_index", indexed_column(&User::id).desc()), table);
storage.sync_schema();
}
{
auto storage = make_storage({}, make_index("name_index", &User::name), table);
storage.sync_schema();
}
{
auto storage = make_storage({}, make_index("name_index", indexed_column(&User::name)), table);
storage.sync_schema();
}
{
auto storage = make_storage({}, make_index("name_index", indexed_column(&User::name).collate("binary")), table);
storage.sync_schema();
}
{
auto storage =
make_storage({}, make_index("name_index", indexed_column(&User::name).collate("binary").asc()), table);
storage.sync_schema();
}
{
auto storage =
make_storage({}, make_index("name_index", indexed_column(&User::name).collate("binary").desc()), table);
storage.sync_schema();
}
}