README.md in rack-queries-0.2.1 vs README.md in rack-queries-0.3.0
- old
+ new
@@ -1,8 +1,8 @@
# Rack::Queries
-[![Build Status](https://travis-ci.com/CultureHQ/rack-queries.svg?branch=master)](https://travis-ci.com/CultureHQ/rack-queries)
+[![Build Status](https://github.com/CultureHQ/rack-queries/workflows/Main/badge.svg)](https://github.com/CultureHQ/rack-queries/actions)
[![Gem Version](https://img.shields.io/gem/v/rack-queries.svg)](https://github.com/CultureHQ/rack-queries)
This gem provides a page in your rack-based (e.g., `Rails`, `Sinatra`) application that allows quick execution of pre-built queries. The goal is to allow quick insights into the state of your application without needing to update the main UI. Consider it a backdoor admin page that you can use before you decide to truly expose query results.
![Screenshot](docs/screenshot.png)
@@ -73,9 +73,30 @@
Org.order(:name).pluck(:name)
end
run do |opts|
Org.where(name: opts['org']).users.count
+ end
+end
+```
+
+With the DSL, you can additionally provide a `type` for your options that allows them to be specified on the client side. By default, the type is `select`, which will perform a query to the server to get the list of options. However, if you specify one of the other types (`string` or `text`), it will instead allow the user to provide input. For example, to allow a text area field, you would:
+
+```ruby
+Rack::Queries.create do
+ name 'Some CSV parsing'
+ desc 'Parse some CSV input!'
+
+ opt :csv, type: :text
+
+ run do |opts|
+ require 'csv'
+
+ CSV.foreach(opts['csv']) do
+ ...
+ end
+
+ ...
end
end
```
### Middleware