npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@riao/dbal

v3.8.0

Published

riao database

Downloads

394

Readme

riao-dbal

npm version License: MIT

A powerful TypeScript Database Abstraction Layer (DBAL) that provides a unified interface for working with multiple database types including MySQL, PostgreSQL, MSSQL, and SQLite.

Features

  • 🔄 Multi-Database Support: Work with multiple databases using the same API
  • 🏗️ TypeScript First: Full TypeScript support with type safety and autocompletion
  • 🔨 Query Builder: Fluent interface for building complex SQL queries
  • 📊 Reporting & Analytics: Built-in support for aggregations, window functions, and complex data analysis
  • 🚀 Migrations: Version control for your database schema
  • 📦 Column Pack: Ready-to-use column definitions for common fields like usernames, emails, and timestamps
  • 🌱 Seeding: Populate your database with test data
  • 🔍 Schema Management: Track and manage your database schema
  • 💰 Transactions: Support for database transactions
  • 🛠️ DDL Operations: Create, alter, and drop database objects
  • Database Functions: Built-in support for common database functions

Getting Started

Read the getting started guide.

Preview

Creating a new Database

npx riao db:create

Database Setup Guide

Creating a Migration

npx riao migration:create create-users-table

Database Migration Guide

import { Migration } from '@riao/dbal';
import { ColumnType } from '@riao/dbal';
import {
	BigIntKeyColumn,
	EmailColumn,
	UsernameColumn,
	PasswordColumn,
	CreateTimestampColumn,
	UpdateTimestampColumn,
} from '@riao/dbal/column-pack';

export default class Users extends Migration {
	override async up() {
		await this.ddl.createTable({
			name: 'users',
			ifNotExists: true,
			columns: [
				BigIntKeyColumn,
				UsernameColumn,
				EmailColumn,
				PasswordColumn,
				{
					name: 'balance',
					type: ColumnType.DECIMAL,
					significant: 15,
					decimal: 2,
					required: true,
					default: 10000.0,
				},
				CreateTimestampColumn,
				UpdateTimestampColumn,
			],
		});
	}

	override async down() {
		await this.ddl.dropTable({
			tables: 'users',
			ifExists: true,
		});
	}
}

Run your migrations with npx riao migration:run

Creating Repositories

src/users/user-repository.ts

import { maindb } from '../../database/main';

export interface User {
	id: number;
	username: string;
	email: string;
	password: string;
	balance: number;
	create_timestamp: Date;
	update_timestamp: Date;
}


export const users = maindb.getQueryRepository<User>({
	table: 'users'
});

Model Repositories Guide

Queries


// Insert a record
await users.insertOne({
    username: 'John Doe',
    email: '[email protected]'
});

// Find records
const results = await users.find({
    where: {
        email: '[email protected]'
    }
});

Query Guide

Documentation

For detailed documentation, please read the docs!

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Support

If you encounter any issues or have questions, please open an issue on our GitHub repository.