Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voxoco/vorm
VORM - VOXO ORM like Deno module with a simple interface and hot-swappable backends
https://github.com/voxoco/vorm
db deno mysql orm rqlite typescript
Last synced: about 1 month ago
JSON representation
VORM - VOXO ORM like Deno module with a simple interface and hot-swappable backends
- Host: GitHub
- URL: https://github.com/voxoco/vorm
- Owner: voxoco
- License: mit
- Created: 2022-11-29T04:46:35.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-02T20:07:21.000Z (about 2 years ago)
- Last Synced: 2024-10-17T17:44:51.021Z (3 months ago)
- Topics: db, deno, mysql, orm, rqlite, typescript
- Language: TypeScript
- Homepage: https://voxo.co
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VORM - VOXO ORM :notebook:
VORM is a simple ORM like Deno module for VOXO which provides a simple interface for various backend databases (currently MySQl and rqlite are supported).
- Works with MySql, rqlite
- Simple interface (single entry point)
- Easy to swap backend database on a per query basis
- Easy to extend with new backend databases
- Usage of named parameters## Usage
```ts
import { Vorm } from "https://deno.land/x/vorm/mod.ts";const db = new Vorm('mysql://root:root@localhost:3306/main', 'http://localhost:4001/db');
const res = await db.getUserById(98);
console.log(res);
```## Response Object
Response object is a simple object with the following properties:
```ts
{
req: { // Request object
sql: string, // SQL query
vales: { [key: string]: any }, // Values for named parameters
db: string, // Database name
isWrite: boolean, // Is write query
queue: boolean, // Is queued write query (rqlite only)
},
rows: { [param: string]: string | number }[], // Rows returned by the SELECT query
affectedRows: number, // Number of affected rows by the INSERT/UPDATE/DELETE query
insertId: number, // Insert ID of the INSERT query
time: number, // Time taken to execute the query (rqlite only)
error: string, // Error message if any
}
```