A lightweight Ruby ORM inspired by ActiveRecords from Ruby on Rails. Herodotus converts tables in Sqlite3 database into Herodotus::SQLObject class
Herodotus can perform core CRUD methods with associations.
$cd
into "demo folder"- Run demo by
$ruby demo.rb
- Create SQLite3 tables with SQL like so:
CREATE TABLE names (
id INTEGER PRIMARY KEY,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255) NOT NULL,
FOREIGN KEY(seat_id) REFERENCES name(id)
)
- Create database with cat '{SQL_FILE_NAME}.sql' | sqlite3 '{DB_FILE_NAME}.db'
- Open Sqlite3 database with:
sqlite3 tables.db
- Run DBConnection.open('{DB_FILE_NAME}.db')
Querying is made easy with core features like:
::find
::where
#insert
#update
::all
::table_name
::columns
::attributes
::save
- [x]
chain query commands without hitting database
Herodotus offers ActiveRecord associations like features such as:
-
::has_many
-
::belongs_to
-
::has_one_through
- SQLite3
- ActiveSupport::Inflector