Skip to content

Are there any serious projects doing this? #8

Open
@mindplay-dk

Description

@mindplay-dk

This is crazy impressive! 😄

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

Imagine something like this?

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 but type-safe, and with placeholders (and subsequent binding) rather than template literals.

(since, sadly, typescript doesn't seem to support type-safe template literal functions...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions