import { ORM } from "https://deno.land/x/justaos_orm@v7.1.0/mod.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
Get connection to database
Get connection to database
import {ORM} from "https://deno.land/x/justaos_odm@$VERSION/mod.ts";
const odm = new ORM({
hostname: "localhost",
port: 5432,
username: "postgres",
password: "postgres"
});
odm.connect();
Constructors
new
ORM(config: DatabaseConfiguration, logger?: Logger)Methods
addDataType(dataType: DataType): void
addInterceptor(operationInterceptor: DatabaseOperationInterceptor): void
connect(createDatabaseIfNotExists?: boolean): Promise<ORMConnection>
deleteInterceptor(operationInterceptorName: string): void
getTableSchema(tableName: string): TableSchema | undefined
isDatabaseExist(): Promise<boolean>
isTableDefined(tableName: string): boolean
Static Methods
generateRecordId(): UUID
isValidRecordId(id: UUID): boolean