hai-reldb

Provide unified relational database access across SQLite, PostgreSQL, and MySQL.

3|7|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/hai-series/hai-framework --skill hai-reldb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hai-reldb
Source: https://github.com/hai-series/hai-framework/tree/main/packages/cli/templates/skills/hai-reldb
Command: npx skills add https://github.com/hai-series/hai-framework --skill hai-reldb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

使用 @h-ai/reldb 进行 SQLite/PostgreSQL/MySQL 的初始化、SQL/DDL/CRUD/事务与分页操作;当需求涉及数据库访问、CRUD 仓库、事务处理、分页查询或 HaiReldbError 分支处理时使用。

Core Features & Use Cases

  • 提供统一的数据库操作接口,支持 DDL、SQL、CRUD、事务和分页,跨主流数据库一致性地处理数据。
  • 通过 BaseReldbCrudRepository 实现业务仓库封装,简化数据访问并自动处理时间戳和布尔/JSON 映射。
  • 支持事务包裹与跨仓库协同,确保异常回滚与提交的可靠性,提升数据一致性。

Quick Start

在 config/_db.yml 配置数据库并初始化 reldb,然后按示例使用 reldb.sql、reldb.crud.table 与 reldb.tx 进行数据访问和事务处理。

Frequently Asked Questions about hai-reldb

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle unified database access across SQLite, PostgreSQL, and MySQL in TypeScript?

Cross-database transactions are managed using transactional wrappers that coordinate repository operations. This ensures reliable commits and automatic rollbacks during exceptions, maintaining data consistency across SQLite, PostgreSQL, and MySQL.

How does the BaseReldbCrudRepository simplify relational database CRUD operations?

The BaseReldbCrudRepository simplifies relational database CRUD operations by providing a business repository pattern. It automatically handles timestamping and maps boolean and JSON fields, reducing manual data conversion logic.

What is the best way to structure data-layer modules for multiple SQL databases?

Structuring data-layer modules for multiple SQL databases is best achieved by extending the BaseReldbCrudRepository. This approach enforces consistent API results and abstracts DDL, CRUD, and transaction handling for production-grade repositories.

Does this relational database Skill support pagination and structured error handling?

Pagination and structured error handling are fully supported for relational database queries. The Skill enforces a consistent HaiResult-based API and provides specific HaiReldbError branches for precise error handling during data access.