LDkit

method Lens.prototype.insert
import { Lens } from "https://deno.land/x/ldkit/mod.ts";

Inserts one or more entities to the data store.

Examples

Example 1

import { createLens } from "ldkit";
import { schema } from "ldkit/namespaces";

// Create a schema
const PersonSchema = {
  "@type": schema.Person,
  name: schema.name,
} as const;

// Create a resource using the data schema above
const Persons = createLens(PersonSchema);

// Insert a new person
await Persons.insert({
  $id: "http://example.org/Alan_Turing",
  name: "Alan Turing",
});

Parameters

...entities: Entity<SchemaInterface<T>>[]

Entities to insert

Returns

Promise<void>

Nothing