mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-13 15:22:30 +00:00
The pages describing this code lived in lancedb/docs, a repository with ten stars that neither contributing guide mentioned. A user who hit a wrong page while reading the source had to find a separate, near-invisible repository to fix it. These 102 pages now sit beside the code, and a documentation fix is a pull request in the repository the reader already had open. `docs/web` is a complete Mintlify site: `cd docs/web && mint dev` serves it with no other checkout. Enterprise pages stay private and are merged in when the published site is assembled, so links into them do not resolve here — every open-source page does. `docs/web-tests` holds the tests the code examples are extracted from. They ran against a published wheel before; here they can run against this repository's own SDK, so an example that stops compiling fails the pull request that broke it rather than being noticed later. Both directories sit beside `docs/src` and are invisible to it: mkdocs reads `docs_dir: src`, so the SDK reference builds and deploys exactly as before.
9 lines
1.5 KiB
Plaintext
9 lines
1.5 KiB
Plaintext
{/* Auto-generated by scripts/mdx_snippets_gen.py. Do not edit manually. */}
|
|
|
|
export const TsInsertIfNotExists = "const table2 = await db.createTable(\"domains\", [\n { domain: \"google.com\", name: \"Google\" },\n { domain: \"github.com\", name: \"GitHub\" },\n]);\n\nconst newDomains = [\n { domain: \"google.com\", name: \"Google\" },\n { domain: \"facebook.com\", name: \"Facebook\" },\n];\nawait table2\n .mergeInsert(\"domain\")\n .whenNotMatchedInsertAll()\n .execute(newDomains);\nawait table2.countRows(); // 3\n";
|
|
|
|
export const TsReplaceRange = "const table3 = await db.createTable(\"chunks\", [\n { doc_id: 0, chunk_id: 0, text: \"Hello\" },\n { doc_id: 0, chunk_id: 1, text: \"World\" },\n { doc_id: 1, chunk_id: 0, text: \"Foo\" },\n { doc_id: 1, chunk_id: 1, text: \"Bar\" },\n]);\n\nconst newChunks = [{ doc_id: 1, chunk_id: 0, text: \"Baz\" }];\n\nawait table3\n .mergeInsert([\"doc_id\", \"chunk_id\"])\n .whenMatchedUpdateAll()\n .whenNotMatchedInsertAll()\n .whenNotMatchedBySourceDelete({ where: \"doc_id = 1\" })\n .execute(newChunks);\n\nawait table3.countRows(\"doc_id = 1\"); // 1\n";
|
|
|
|
export const TsUpsertBasic = "const table = await db.createTable(\"users\", [\n { id: 0, name: \"Alice\" },\n { id: 1, name: \"Bob\" },\n]);\n\nconst newUsers = [\n { id: 1, name: \"Bobby\" },\n { id: 2, name: \"Charlie\" },\n];\nawait table\n .mergeInsert(\"id\")\n .whenMatchedUpdateAll()\n .whenNotMatchedInsertAll()\n .execute(newUsers);\n\nawait table.countRows(); // 3\n";
|
|
|