Module

x/justaos_orm/src/ORM.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/ORM.ts";

JUSTAOS's ORM (Object Document Mapper) is built for Deno and provides transparent persistence for JavaScript objects to Postgres database.

  • Supports all primitive data types (string, integer, float, boolean, date, object, array, etc).
  • Supports custom data types.
  • Supports table with multi-level inheritance.
  • Also supports interception on operations (create, read, update and delete).

Examples

Example 1

import { ORM } from "@justaos/orm";
const odm = new ORM({
 hostname: "localhost",
 port: 5432,
 username: "postgres",
 password: "postgres",
 max_connections: 20
});
odm.connect();

Constructors

new
default(config: TDatabaseConfiguration, logger?: Logger)

Methods

addDataType(dataType: IDataType): void

Adds a new data type to the registry.

addInterceptor(operationInterceptor: RecordInterceptor): void

Adds a new operation interceptor to the service.

connect(createDatabaseIfNotExists?: boolean): Promise<ORMClient>

Establishes a connection to the database.

deleteInterceptor(operationInterceptorName: string): void

Deletes an operation interceptor from the service.

isTableDefined(tableName: string): boolean

Checks if a table is defined in the registry.

Static Methods

Generates a new record ID.

isValidRecordId(id: UUID4): boolean

Checks if the given ID is a valid record ID.