Project

terrazine

0.0
No commit activity in last 3 years
No release in over 3 years
You can take a look at [github](https://github.com/Aeonax/terrazine).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0

Runtime

= 1.2.0
 Project Readme

Terrazin

Simple and comfortable, as possible, data structures parser in to SQL.

Describing sql with data structures like honeysql or ql in clojure.

Construct data structures inside Constructor instance.

Get result and access any returned data rails like syntax.

Realization

This was my first meeting with OOP... Now it's scary inside, but there is 0.0.4 will be soon that will be not so scary=))

DB adapters

Now? supports only Postgresql.

Why?

I tried to find something that will help me to create complex SQL queries, but there was only String and .erb... They didn't respond to my requirements=( In my vision data structures, especially in combination with objects(Constructor), more convinient way for representing complex SQL than String or ORM...
As for me, the right question is why only now? Why so late? Or i still blind...

Usage

Initialization

Add this line to the Gemfile

gem 'terrazine', '0.0.3'

After server initialization set Terrazine.config. Now config accepts only :connection option. In the bright future will be added :adapter option support.
In rails you can set config with after_initialize and it will looks like:

# file config/application.rb
module Name
  class Application < Rails::Application
  # ....
    config.after_initialize do
      Terrazine.config connection: -> { ActiveRecord::Base.connection.raw_connection }
    end
  # ....
  end
end

Workflow

  • Describe whole data structure, or create Constructor instance and combine parts of data by it instance methods.
  • Send result to Terrazine.send_request(structure||constructor, params = {})
  • Rejoice at the ::Result

Updates:

0.0.3

  • Expand predicates syntax
  • added support of multiple rows for VALUES
  • ORDER structure
  • UPDATE structure
  • scary tests-_-

Contact

You can write me your suggestions for improving the syntax, wishes, things that you think are missing here.
My email, Ruby On Rails slack