Skip to content

ducnt114/g0database

Repository files navigation

g0database

Github Actions codecov

A SQL database, written from scratch in Go

Inspired by

Lexer

  • Split raw sql command to token

raw sql: select id, name, age from user where status = 'ACTIVE' and id > 10

=> tokens: ["select", "id", ",", "name", ",", "age", "from", "user", "where", "status", "=", "'", "ACTIVE", "'", "and", "id", ">", "10"]

Parser

  • Make Abstract syntax tree (AST) from list tokens
root
 |- select
 |---- fields (id, name, age)
 |- from
 |---- tables (user)
 |- where
 |---- conditions
           |---- status
           |---- =
           |---- ACTIVE
       |- AND
           |---- id
           |---- >
           |---- 10

Releases

No releases published

Packages

No packages published

Languages