Project

immudb

0.01
The project is in a healthy, maintained state
Ruby client for immudb
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

immudb-ruby

Ruby client for immudb

Build Status

Installation

Add this line to your application’s Gemfile:

gem "immudb"

Getting Started

Create a client

immudb = Immudb::Client.new

All of these options are supported

Immudb::Client.new(
  host: "localhost",
  port: 3322,
  username: "immudb",
  password: "immudb",
  database: "defaultdb",
  timeout: nil
)

You can also use a URL. Set ENV["IMMUDB_URL"] or use:

Immudb::Client.new(url: "immudb://user:pass@host:port/dbname")

Keys

Set and get keys

immudb.set("hello", "world")
immudb.get("hello")

Set and get keys with verification

immudb.verified_set("hello", "world")
immudb.verified_get("hello")

Set and get multiple keys

immudb.set_all({"a" => "one", "b" => "two"})
immudb.get_all(["a", "b"])

Get the history of a key

immudb.history("key")

Iterate over keys

immudb.scan

SQL

List tables

immudb.list_tables

Create a table

immudb.sql_exec("CREATE TABLE cities (id INTEGER, name VARCHAR, PRIMARY KEY id)")

Describe a table

immudb.describe_table("cities")

Execute a statement

immudb.sql_exec("INSERT INTO cities (id, name) VALUES (@id, @name)", {id: 1, name: "Chicago"})

Query data

immudb.sql_query("SELECT * FROM cities WHERE id = @id", {id: 1}).to_a

See the SQL Reference for more info

Databases

List databases

immudb.list_databases

Create a database

immudb.create_database("dbname")

Change the database

immudb.use_database("dbname")

Users

List users

immudb.list_users

Create a user

immudb.create_user("user", password: "P@ssw0rd", permission: :read_write, database: "dbname")

Permission can be :read, :read_write, or :admin

Change password

immudb.change_password("user", old_password: "P@ssw0rd", new_password: "P@ssw0rd2")

Other

Check health

immudb.healthy?

Clean indexes

immudb.clean_index

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/immudb-ruby.git
cd immudb-ruby
bundle install
bundle exec rake test