Skip to content
/ jsqx Public

Cursed lib to make SQL Queries in JSX (dont use this)

Notifications You must be signed in to change notification settings

achrafl0/jsqx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSQX

image

A cursed librairy to create SQL queries using JSX

License

YOU CAN ONLY USE THIS LIBRAIRY IN PURELY COMMERCIAL PROJECTS. I want to see this in prod (for legal reasons this is a joke, you can use this whatever you want, just you know, a bit of credit would be nice)

USAGE

const query = (
  <Select table="Users" columns={["*"]} alias="u">
    <Where>
      <Clause clause={`u.id = ${author.id}`} />
      <Clause clause={`u.isAdmin = ${author.isAdmin}`} />
    </Where>
    <Sort column="createdAt" order="asc" />
    <Limit value={100} />
  </Select>
);

// With TypeORM
const rawData = await manager.query(query);

// With Prisma

const result = await prisma.$queryRaw(
  Prisma.sql`${query}`
)

## Testing

Didn't test, don't care, don't @ me

TODO

  • Support UPDATE
  • Support DELETE
  • Support INSERT
  • Support Transactions (that's gonna be fun)

About

Cursed lib to make SQL Queries in JSX (dont use this)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published