Skip to content

crowl/sql2lua

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
April 18, 2016 23:15
April 17, 2016 23:34
April 18, 2016 18:13
April 18, 2016 23:17

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'

About

Generate lua functions from SQL queries

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages