Documentation
Data Strategy

Database ORM

A natively compiled Query Builder that avoids raw SQL entirely while running at maximum CGO speeds.

01

Retrieving Data

Chain filters safely without SQL Injection vulnerabilities. The engine handles parameter binding automatically.

query.kitwork.js
// Select Multiple Rows
const users = db.table("user").limit(5).list();

// Filter Single Row
const admin = db.table("user").where((u) => u.role == "admin").first();
02

Create & Update

Manipulate data using pure JSON objects. Validation is performed at the engine level.

mutate.kitwork.js
db.table("user").create({
    username: "hacker101",
    is_active: true
});

db.table("user").where(user => user.id == 5).update({
    is_active: false
});
03

Advanced Filtering & Scopes

Perform counts, checks, limit rows, and execute shortcuts with fast Javascript lambda filtering options.

scopes.js
// 1. Lambda query builder limits & shortcuts
const topUsers = db.limit(3).list(u => u.id > 5);

// 2. Existence verification
const exists = db.exists(u => u.username == "grace");

// 3. Counts based on filters
const activeCount = db.count(u => u.is_active == true);
04

Database Joins & Raw Queries

Link separate tables together with high-performance joins, or escape to raw SQL when running complex database operations.

joins-raw.js
// 1. Inter-table database joins
const orders = db.join((order, user) => order.user_id == user.id).list();

// 2. Raw query output string
const rawSql = db.table("user").where(u => u.username == "alice%").Raw();
05

Database Transactions & Safety

Every query runs parameter bindings automatically to block injection vectors. Run isolated mutations inside safe execution scopes.

safety.js
// Safely escape user inputs by chaining parameter filters
const userInput = "admin' OR 1=1--";

db.table("user").find("username", userInput);
// Generates prepared query: SELECT * FROM "user" WHERE username = $1
06

Postgres Driver Configuration

Define your database server connection details inside the central application configuration keys.

config.kitwork.yaml
database:
  type: "postgres"
  host: "152.42.253.164"   # DB server address
  port: 5432
  user: "postgres"
  password: "kitwork@123"
  name: "master"
  ssl: "require"