LibWeb/IDB: Implement IDBObjectStore::createIndex

This commit is contained in:
stelar7 2025-04-01 18:37:23 +02:00 committed by Andrew Kaster
commit 3367352991
Notes: github-actions[bot] 2025-04-09 17:50:46 +00:00
7 changed files with 88 additions and 14 deletions

View file

@ -25,7 +25,7 @@ Index::Index(GC::Ref<ObjectStore> store, String name, KeyPath const& key_path, b
, m_multi_entry(multi_entry)
, m_key_path(key_path)
{
store->add_index(*this);
store->index_set().set(name, *this);
}
void Index::visit_edges(Visitor& visitor)
@ -39,4 +39,13 @@ void Index::visit_edges(Visitor& visitor)
}
}
void Index::set_name(String name)
{
// NOTE: Update the key in the map so it still matches the name
auto old_value = m_object_store->index_set().take(m_name).release_value();
m_object_store->index_set().set(name, old_value);
m_name = move(name);
}
}