import { default } from "https://deno.land/x/justaos_orm@v9.1.2/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
Example 1
import { ORM } from "@justaos/orm";
const odm = new ORM({
hostname: "localhost",
port: 5432,
username: "postgres",
password: "postgres"
});
odm.connect();
Constructors
new
default(config: DatabaseConfiguration, logger?: Logger)Methods
addDataType(dataType: DataType): void
Adds a new data type to the registry.
addInterceptor(operationInterceptor: DatabaseOperationInterceptor): void
Adds a new operation interceptor to the service.
connect(createDatabaseIfNotExists?: boolean): Promise<ORMConnection>
Establishes a connection to the database.
deleteInterceptor(operationInterceptorName: string): void
Deletes an operation interceptor from the service.
isDatabaseExist(): Promise<boolean>
Checks if the database exists.
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.