/* * Copyright (c) 2025, stelar7 * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::IndexedDB { // https://w3c.github.io/IndexedDB/#object-store-record struct ObjectStoreRecord { GC::Ref key; HTML::SerializationRecord value; }; // https://w3c.github.io/IndexedDB/#index-list-of-records struct IndexRecord { GC::Ref key; GC::Ref value; }; // https://pr-preview.s3.amazonaws.com/w3c/IndexedDB/pull/461.html#record-snapshot // https://pr-preview.s3.amazonaws.com/w3c/IndexedDB/461/95f98c0...43e154b.html#record-interface class IDBRecord : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(IDBRecord, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(IDBRecord); public: [[nodiscard]] static GC::Ref create(JS::Realm& realm, GC::Ref key, JS::Value value, GC::Ref primary_key); virtual ~IDBRecord(); GC::Ref key() const { return m_key; } GC::Ref primary_key() const { return m_primary_key; } JS::Value value() const { return m_value; } protected: explicit IDBRecord(JS::Realm&, GC::Ref key, JS::Value value, GC::Ref primary_key); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Visitor& visitor) override; private: GC::Ref m_key; JS::Value m_value; GC::Ref m_primary_key; }; }