UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

24 lines (23 loc) 1.38 kB
import type { Data } from "../../util/data.js"; import type { Identifier } from "../../util/item.js"; import type { QueryFilter } from "../../util/query.js"; import type { Segments } from "../../util/string.js"; import type { Update } from "../../util/update.js"; import type { Collection } from "../collection/Collection.js"; import { type SQLFragment, SQLProvider } from "./SQLProvider.js"; /** * Abstract SQLite provider with JSON1 function support for nested keys, array containment, and array mutations. * * Note the following compatibility caveats: * - For `with` and `omit` updates this does not preserve ordering of the original array. * - For `with` and `omit` updates this does not guarantee equality for de-duplication when working with nested objects or arrays. */ export declare abstract class SQLiteProvider<I extends Identifier = Identifier, T extends Data = Data> extends SQLProvider<I, T> { addItem<II extends I, TT extends T>(collection: Collection<string, II, TT>, data: TT): Promise<II>; /** Get the SQLite JSON path for the nested segments of a key (everything after the column name), e.g. `$.b.c` */ private sqlPath; /** Get the SQLite JSON extract syntax, e.g. `json_extract("a", $.b.c)` */ sqlExtract(key: Segments): SQLFragment; sqlUpdate(update: Update): SQLFragment; sqlFilter(filter: QueryFilter): SQLFragment; }