Codync
무료 오픈소스 1:1 대안, Grok Bot과 Muse 대신
저장소 정보는 아직 수집하지 않았습니다.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
No compromises TypeScript ORM
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗A TypeScript ORM for Postgres, SQLite and MySQL with schemas, changesets, composable queries and a repo, typed end to end with no code generation.
select results are
inferred from your classes. No generate step, no schema file to keep in sync.{ success, data } or { success: false, error }.save() on rows. Nothing joins a transaction you did not open; a single call that
writes several statements (a parent with its children, a chunked insertAll) is atomic
on its own.Status: under construction. Nothing is published to npm yet. The design and build plan live in
docs/plan/README.md.
pnpm add egon-orm @egon-orm/postgres pg
Node.js 22.12 or later; ES modules (a CommonJS project can require() them on Node.js 22.12
or later). For SQLite use @egon-orm/sqlite with better-sqlite3; for MySQL,
@egon-orm/mysql with mysql2.
import { postgres } from "@egon-orm/postgres";
import { belongsTo, cast, count, createRepo, from, hasMany, Schema, t, timestamps } from "egon-orm";
// Over two tables with serial (32-bit) keys, which t.integer() reads.
class User extends Schema("users", {
id: t.integer().primaryKey().dbGenerated(),
email: t.string(),
name: t.string().nullable(),
...timestamps(),
}) {
static posts = hasMany(() => Post, { foreignKey: "authorId" });
static changeset(user: User | typeof User, params: unknown) {
return cast(user, params, ["email", "name"]).validateRequired(["email"]).uniqueConstraint("email");
}
}
class Post extends Schema("posts", {
id: t.integer().primaryKey().dbGenerated(),
authorId: t.integer(),
title: t.string(),
}) {
static author = belongsTo(() => User, { foreignKey: "authorId" });
}
const repo = createRepo({ adapter: postgres({ connectionString: process.env.DATABASE_URL }) });
const result = await repo.insert(User.changeset(User, { email: "[email protected]" }));
if (!result.success) console.log(result.error.errorMessages()); // if the email is taken: { email: ["has already been taken"] }
const authors = await repo.all(
from(User, "u")
.where(({ u }) => u.name.isNotNull())
.preload("posts"),
);
authors[0]?.posts[0]?.title; // string: the type knows "posts" was preloaded
const stats = await repo.all(
from(User, "u")
.leftJoinAssoc("u", "posts", "p")
.groupBy(({ u }) => u.id)
.select(({ u, p }) => ({ email: u.email, posts: count(p.id) })),
); // { email: string; posts: number }[]
The documentation site is egon-orm.github.io/egon-orm.
Its pages are Markdown in docs/site, readable here on GitHub too, and
pnpm docs:dev serves the site, API reference included, locally.
| Package | Purpose |
|---|---|
egon-orm | Schemas, types, changesets, queries, the repo; egon-orm/testing and egon-orm/migration |
@egon-orm/postgres | The Postgres adapter (every feature) |
@egon-orm/sqlite, @egon-orm/mysql | The SQLite and MySQL adapters (documented gaps) |
@egon-orm/zod | Zod schemas derived from schema classes |
@egon-orm/cli | The egon command: migrations and development databases |
Requires Node.js 22.12 or newer, pnpm 12 and Docker.
pnpm i
pnpm db:up # Postgres 16 on localhost:54329
pnpm check # lint + typecheck + unit tests + type tests + build
pnpm test:integration # needs the database
pnpm docs:dev # documentation site
See CONTRIBUTING.md for everything else.