codemix / codemix/ts-sql

Are there any serious projects doing this?

Open
#8 15 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.3k
Forks
53
PR merge metrics
No merged PRs in 30d

Description

This is crazy impressive! 😄

What would be really cool, is if we could actually turn this into something useful.

Imagine something like this?

```ts
const sql = createShema({
users: {
user_id: type.number(),
email: type.string(255),
// ...
}
});

const userQuery = sql("SELECT * FROM users WHERE user_id = :user_id").bind({ user_id: 123 });
```

Imagine this would validate query structure and schema names, and return a type that infers the shape of the rows.

Something like [`sql-template-tag`](https://www.npmjs.com/package/sql-template-tag) but type-safe, and with placeholders (and subsequent binding) rather than template literals.

(since, sadly, typescript [doesn't](https://github.com/microsoft/TypeScript/issues/33304#issuecomment-1637784732) seem to support type-safe template literal functions...)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.