Skip to main content
Module

x/ldkit/library/lens/mod.ts>Lens#count

LDkit - Linked Data query toolkit for TypeScript developers
Latest
method Lens.prototype.count
import { Lens } from "https://deno.land/x/ldkit@2.0.0/library/lens/mod.ts";

Returns the total number of entities corresponding to the data schema.

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);

// Count all persons
const count = await Persons.count(); // number

Returns

Promise<number>

total number of entities corresponding to the data schema