0.0.13 • Published 5 months ago

@colyseus/database v0.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@colyseus/database

GitHub Feature Proposal: https://github.com/colyseus/colyseus/issues/594

This is a small layer of abstraction over Kysely, while also exposing it directly.

(Kysely currently has built-in support for SQLite, PostgreSQL, and MySQL.)

This is not an ORM!

Planned features

  • ORM-like API
  • Be frictionless during development: provide automatic migration when inserting data into the database (could be disabled in production)
  • Create and run migrations from the CLI.

Usage

import { Database, PostgresDialect } from "@colyseus/database";
import pg from "pg";

// schema fields
interface Player {
  name: string;
}

const db = new Database<{
  // database schema / types
  players: Player,
}>({
  // database config
  dialect: new PostgresDialect({
    pool: new pg.Pool({
      host: "localhost",
      database: "endel",
    })
  })
});

// collection API
const Player = db.collection("players");
const playerId = await Player.insert({
  name: "Rigolo"
});

External Tooling

Notes:

@alexanderson1993: Prisma-like Migrations and type safety with Kysely

License

MIT

0.0.12

5 months ago

0.0.13

5 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago