Skip to content

IbrahimShamma99/sql-js-tiny-compiler

Repository files navigation

SQL into JS Runtime (Node.js)

Fun Project with SQL and JS

Props to Crafting Interpreters && SQL-Tooling for the knowledge and inspiration

Example

import { Generator } from 'sql-js-data-mapper'

const generator = new Generator([
  { id: 'id1', user_name: 'user1' },
  { id: 'id2', user_name: 'user2' },
])

generator.execute(`
  SELECT id, user_name as username
  FROM users
  WHERE id = 'id1'
`)

// returns [{ id: "id1", username: "user1" }]

For More examples, check here

TODO List

  • Basic SQL Parser
  • Accept Where in Select Statement
  • Accept Group By in Select Statement
  • Accept Order By in Select Statement
  • Accept JSON Objects in From Statement
  • Add Support Aggregates Functions inside Select Statement
  • Make Order by accept Numeric Expressions and Aggregate Functions
  • Support sub-queries in Select Statement
  • Ask for AST from Select Statement Parser
  • SQL Syntax Analyzer

About

SQL & JSON Compiler into JS Style

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages