Giter Club home page Giter Club logo

tarantool-ruby's Introduction

Tarantool16

This is adapter for tarantool version 1.6.

(adapter for version <=1.5 is called tarantool)

Installation

Add this line to your application's Gemfile:

gem 'tarantool16'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tarantool16

Usage

Currently only simple single threaded one-request-at-time connection implemented.

require 'tarantool16'

db = Tarantool16.new host:'localhost:33013'
#db = Tarantool16.new host:'localhost:33013', user:'tester', password:'testpass'

# select from '_space' space info about 'test' table
# returns array of tuples as an array
tar.get(272, ['test'], index: 2)

# same, but return tuples as a hashes
tar.get(272, ['test'], index: 2, hash: true)

# same with names
# Names and index descriptions are fetched from tarantool.
# Index is autodetected by key names
tar.get(:_space, {name: 'test'})

# get all spaces
tar.select(:_space, nil, iterator: :all)
tar.select(:_space, nil, iterator: :all, hash: true)

tar.select(:_space, [512], index: 0, iterator: :>=, hash: true)

# override tuple field definition
tar.define_fields(:test, [:id, :name, :value])

tar.insert(:test, [1, 'buddy', [1,2,3]])
tar.replace(:test, [1, 'buddy!', [2,3,4]])
tar.update(:test, [1], [[':', 1, 6, 6, '?']])
#tar.update(:test, [1], [[':', 1, 6, 6, '?']], index: 0)
tar.delete(:test, [1])
#tar.delete(:test, [1], index: 0)

tar.insert(:test, {id: 1, name: 'buddy', value: [1,2,3]})
tar.replace(:test, {id: 1, name: 'buddy!', value: [2,3,4]})
tar.update(:test, {id: 1}, {name: [':', 6,6,'?']})
tar.delete(:test, {id: 1})

# note: currenlty there is no documented way to store field definition in an tarantool
# but actually you can do it with this
tar.update(:_space, {name: 'test'}, {format: [:=, [{name: :id, type: :num}, {name: :name, type: :str}, {name: :value, type: '*'}]]})

Changelog

0.0.8 - Fix schema read from new tarantool versions Implement UPSERT 0.0.7 - Implement EVAL, fix REPLACE 0.0.6 - DumbConnection supports timeouts

Contributing

  1. Fork it ( https://github.com/funny-falcon/tarantool16/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Or simply fill an issue

tarantool-ruby's People

Contributors

funny-falcon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.