Tarantool connector for Lua
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Add license file May 16, 2017
README.md Update example Jul 28, 2017
Tupfile Add Tupfile Jun 14, 2017
const.lua Merge branch 'master' of https://github.com/tarantool/tarantool-lua Aug 17, 2017
lua-tarantool-scm-1.rockspec MAke client work with luacrypto instead of slncrypto Jun 17, 2017
tarantool.lua Apply fix from PR #2 Aug 17, 2017
tarantool.moon Apply fix from PR #2 Aug 17, 2017

README.md

lua-tarantool-client

Driver for tarantool 1.7 on nginx cosockets and plain lua sockets

Introduction

A pure Lua driver for the NoSQL database Tarantool using fast nginx cosockets when available, or luasocket as a fallback.

Requires lua-MessagePack.

luasock

For luasock sockets, lua-resty-socket and sha1.lua are required.

These can be installed using luarocks install lua-resty-socket and luarocks install sha1

Synopsis

tarantool = require("tarantool")

-- initialize connection
local tar = tarantool({
    host           = '127.0.0.1',
    port           = 3301,
    user           = 'gg_tester',
    password       = 'pass',
    socket_timeout = 2000,
    connect_now    = true,
})

-- requests
local data, err = tar:ping()
local data, err = tar:insert('profiles', { 1, "nick 1" })
local data, err = tar:insert('profiles', { 2, "nick 2" })
local data, err = tar:select(2, 0, 3)
local data, err = tar:select('profiles', 'uid', 3)
local data, err = tar:replace('profiles', {3, "nick 33"})
local data, err = tar:delete('profiles', 3)
local data, err = tar:update('profiles', 'uid', 3, {{ '=', 1, 'nick new' }})
local data, err = tar:update('profiles', 'uid', 3, {{ '#', 1, 1 }})

-- disconnect or set_keepalive at the end
local ok, err = tar:disconnect()
local ok, err = tar:set_keepalive()