Project

hoaxdb

0.0
No commit activity in last 3 years
No release in over 3 years
This is simple database based on a Hash that uses JSON for storage.It offers interfaces to create,update,delete and query records with a variety of options for queries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.16
~> 5.0
~> 10.0
 Project Readme

Hoaxdb

Hoaxdb is a simple implementation of a database written in 100% pure ruby. It offers an interface to insert,update,query and delete records like any other databse but does not offer complex features of a database. You set specific data types for your fields and you can also have default values on top of that it validates the records you enter. In terms of queries you can choose specific fields, limits and also sort according to a specific field which can be ascending or descending. Queries are written using ruby hence no external knowledge is needed.

Installation

Add this line to your application's Gemfile:

gem 'hoaxdb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hoaxdb

Usage

Using the hoaxdb is very simple once you have installed it, the following are the basics:

Creating a table

require 'hoaxdb'
   db = Hoaxdb.new('products.db') #This reads an existing database or creates a database
   db.create_table("products",{
      "name"=>{"type"=>"String","default"=>""}, #setting default prevents nil values
      "price"=>{"type"=>"Float","default"=>0.0}
   })
   products = db.table("products") # connect to this table

Inserting a record

products.insert({"name"=>"Iphone","price"=>100.67}) #insert a record

Updating a record

products.update('this["name"].eql? "Iphone"',{"quantity"=>200})

Selecting records

products.select_if('this["name"].eql? "Iphone"')

Deleting records

products.del_if('this["name"].eql? "Iphone"')

More information is available via rdoc when the gem is installed

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/njaneambrose/hoaxdb.

License

The gem is available as open source under the terms of the MIT License.