Generate lua functions from SQL queries
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README.md
sql2lua-0.0.1-1.rockspec

README.md

sql2lua

A lua library for transforming SQL queries into lua functions.

Installation

via luarocks

luarocks install sql2lua

Usage

local sql2lua = require "sql2lua"

local sql = [[
-- name: select_foo
select *
  from foo

-- name: select_bar
select *
  from bar
 where name = :name
]]

local queries = sql2lua(sql)

print(queries.select_foo())
-- Output: select * from foo

print(queries.select_bar({ name = "bar" }))
-- Output: select * from bar where name = 'bar'