Module

x/justaos_orm/src/Registry.ts>default

JUSTAOS's ORM (Object–relational mapping) tool is built for Deno and provides transparent persistence for JavaScript objects to Postgres database.
Latest
class default
import { default } from "https://dotland.deno.dev/x/justaos_orm@v10.0.0/src/Registry.ts";

Registry class is a generic class that provides a registry functionality for any type of object. It uses a Map to store the objects, where the key is a string and the value is of type T. The key for each object is determined by a function passed to the constructor.

Constructors

new
default(getKey: (item: T) => string)

Creates a new Registry.

Type Parameters

T

The type of the objects that will be stored in the registry.

Properties

private
registry: Map<string, T>

The Map object that stores the registry items.

Methods

add(item: T): void

Adds an item to the registry. The key for the item is determined by the getKey function passed to the constructor.

delete(name: string): boolean

Deletes an item with the given name from the registry.

get(name: string): T | undefined

Retrieves the item with the given name from the registry.

has(name: string): boolean

Checks if an item with the given name exists in the registry.

hasEntries(): boolean