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

Research direction

The issue is a proposal rather than a scoped implementation task and does not name files, tests, or an entry point. Start by reviewing the repository and the linked sql-template-tag and TypeScript references; a concrete API, implementation scope, and acceptance criteria would need to be established before work can be considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.