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...)
This is crazy impressive! 馃槃
What would be really cool, is if we could actually turn this into something useful.
Imagine something like this?
Imagine this would validate query structure and schema names, and return a type that infers the shape of the rows.
Something like
sql-template-tagbut 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...)