open-index/open-npm huggingface dataset:
npm package: @nuvix/database
Description: A powerful and modern TypeScript database library inspired by cutting-edge technologies and best practices.
Author: Nuvix Tech
Latest version: 1.0.3-alpha.4
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Nuvix Database Library

A powerful and modern TypeScript database library inspired by cutting-edge technologies and best practices.

## Features

- TypeScript-first approach with full type safety
- Adapter-based design supporting multiple database backends
- Document-oriented API with flexible querying capabilities
- Built-in caching for improved performance
- Comprehensive permission system
- Transaction support

## Installation

```bash
npm install @nuvix/database
```

## Usage

```typescript
import { Database } from "@nuvix/database";
import { PostgreDB } from "@nuvix/database/src/adapter/postgre";
import { Cache, Redis } from "@nuvix/cache";

// Create a database adapter
const adapter = new PostgreDB({
    connection: {
        connectionString: "postgres://user:password@localhost:5432/mydb",
        ssl: {
            rejectUnauthorized: false,
        },
    },
    schema: "public",
});

// Initialize the adapter
adapter.init();

// Create a cache instance
const cache = new Cache(new Redis({}));

// Create the database instance
const db = new Database(adapter, cache, {
    logger: true,
});

// Now you can use the database
```

## Testing

This library includes comprehensive tests for both core functionality and specific adapter implementations.

### Running Tests

```bash
# Run core tests only
npm run test

# Run PostgreSQL adapter tests
npm run test:pg

# Run all tests
npm run test:all

# Run tests with specific pattern
npm run test -- --testPathPattern=your-pattern
```

### Test Configuration

Configure test settings by setting environment variables:

```bash
# Enable PostgreSQL tests
PG_TEST_CONNECTION=true npm run test:pg
```

## License

BSD-3-Clause
npm package: @nuvix/pg
Description: PostgreSQL integration for Nuvix
Latest version: 1.3.3

# Nuvix PostgreSQL Library

**Nuvix PG Lib** - A high-performance PostgreSQL library with a fully featured Query Builder. Inspired by Knex.js but with extra 🔥.

## Features

- Query Builder that feels like home (yes, it's from Knex, don't ask how 🤫)
- Supports dynamic JSON-based schema management
- Built-in Role-Based Access Control (RBAC) with **Row-Level Security (RLS)** and **Column-Level Security (CLS)**
- Computed fields with security rules
- Event system using **LISTEN / NOTIFY** & Redis Pub/Sub
- Supports both **Managed** and **Unmanaged** schema modes
- Full TypeScript support (because we know you love types)

---

## Installation

```sh
npm install @nuvix/pg
```

or if you're a yarn enjoyer:

```sh
yarn add @nuvix/pg
```

---

## Usage

### Connecting to DB

```ts
import { DataSource } from "@nuvix/pg";
import { Pool } from "pg";

const pool = new Pool({
  host: "localhost",
  user: "postgres",
  password: "password",
  database: "nuvix_db",
});

const db = new DataSource(pool);
```

### Query Builder

```ts
const users = await db
  .table("users")
  .select("id", "name", "email")
  .where("status", "active");

console.log(users);
```

### Insert Data

```ts
await db.table("users").insert({ name: "John Doe", email: "john@example.com" });
```

### Update Data

```ts
await db.table("users").where("id", 1).update({ status: "inactive" });
```

### Delete Data

```ts
await db.table("users").where("id", 1).delete();
```

### Raw Queries (for when you feel like living on the edge)

```ts
await db.raw("SELECT * FROM users WHERE status = ?", ["active"]);
```

---

## Event System

Listen to database changes in real-time:

```ts
db.listen("user_created", (payload) => {
  console.log("New user:", payload);
});
```

---

## Schema Management

Managed schema with JSON-based structure:

```ts
await db.createTable({
  name: "users",
  schema: "auth",
  columns: {
    id: { type: "uuid", primary: true },
    name: { type: "string", required: true },
    email: { type: "string", unique: true },
  },
  rls: true,
  $permissions: ["read(user:00000)"],
});
```

---

## Why Use This?

- Because raw SQL is too mainstream
- Because we got **real** security (RLS + CLS)
- Because you like your queries builder-style but don't want to use Knex.js directly (we got you 😉)
- Because we **copied Knex but made it better**

---

## License

BSD 3-Clause (yes, you can use this in your billion-dollar startup, just don't blame us if you mess up your queries)