Meet Bob

Bob is under development! This is just a small proof of concept.

A lightweight declarative transpiler that converts bob DSL into SQL code for SQLite, MariaDB, and PostgreSQL. Write less boilerplate, maintain better database logic.

terminal
$ bob -i users.bob -d sqlite -o ./sql/
✨ Successfully transpiled
🚀 Generated SQL for SQLite database!

Why Choose Bob?

Bob combines the simplicity of modern syntax with the power of SQL, giving you the best of both worlds.

See Bob in Action

Write expressive .bob code and let Bob handle the SQL generation for you.

Want to understand how to write it? Go to introduction

PlayGround

.bob input

.bob output

 

If you use the CLI, you can specify an output path (folder) for generating the project.
Bob will analyze all your files and generate the SQL in the specified path, separating tables and actions individually while preserving your original names.

input
user.bob
product.bob
get-user-by-name.bob
get-product-by-id.bob
output
tables.sql
actions
get-user-by-name.sql
get-product-by-id.sql

How to Write Bob Files

table {tableName} { {columnName} {columnType} }
get {tableName} { {columnName} or * | ... to retrieve everything # Using an alias {aliasName}: {columnName} # Filtering if {columnName} {operator} {value} # You can concatenate multiple filters with the same operator for a specific column using && or || if {columnName} {operator} {value} && {value} # To add an alternative condition, you can use `or` above an `if` or {columnName} {operator} {value} || {value} # You can also use left joins with -> -> {tableName} {unionColumnName, "id" by default} { ... } # You can also use subqueries ${aliasName}: get {tableName} { ... } }
set {tableName} { {columnName} {newValue} # or {columnName}: {newValue} # Filtering if {columnName} {operator} {value} # You can concatenate multiple filters with the same operator for a specific column using && or || if {columnName} {operator} {value} && {value} # To add an alternative condition, you can use `or` above an `if` or {columnName} {operator} {value} || {value} }
new {tableName} { {columnName} {newValue} # or {columnName}: {newValue} } # Bulk version new {tableName} {columnName} {columnName} ... { {value} {value} ... }
delete {tableName} { # Filtering if {columnName} {operator} {value} # You can concatenate multiple filters with the same operator for a specific column using && or || if {columnName} {operator} {value} && {value} # To add an alternative condition, you can use `or` above an `if` or {columnName} {operator} {value} || {value} }

Types

Bob supports a variety of data types, including strings, numbers, booleans, and more.

INTEGERS

  • int
  • int8
  • int16
  • int32
  • int64
  • uint
  • uint8
  • uint16
  • uint32
  • uint64

FLOATS

  • float32
  • float64

STRINGS

  • string
  • string8
  • string16
  • string32
  • string64
  • text
  • blob

DATES

  • date
  • time
  • current

SPECIAL

  • id
  • boolean

ATTRIBUTES

  • primary
  • required
  • index
  • auto_increment
  • unique
  • optional
  • isolated
  • = (default value)

LITERALS

  • @now
  • @date
  • @time
  • @utc
  • @sysdate