README.md in github-ds-0.1.0 vs README.md in github-ds-0.2.0

- old
+ new

@@ -31,11 +31,11 @@ ### GitHub::KV First, you'll need to create the `key_values` table using the included Rails migration generator. ``` -rails generate github:kv:active_record +rails generate github:ds:active_record rails db:migrate ``` Once you have created and executed the migration, KV can do neat things like this: @@ -89,28 +89,41 @@ ### GitHub::SQL ```ruby # Select, insert, update, delete or whatever you need... -statement = "INSERT INTO example_key_values (`key`, `value`) VALUES (:key, :value)" -GitHub::SQL.run statement, key: "foo", value: "bar" +GitHub::SQL.results <<-SQL + SELECT * FROM example_key_values +SQL -statement = "SELECT value FROM example_key_values WHERE `key` = :key" -GitHub::SQL.value select_statement, key: "foo" +GitHub::SQL.run <<-SQL, key: "foo", value: "bar" + INSERT INTO example_key_values (`key`, `value`) + VALUES (:key, :value) +SQL +GitHub::SQL.value <<-SQL, key: "foo" + SELECT value FROM example_key_values WHERE `key` = :key +SQL + # Or slowly build up a query based on conditionals... -sql = GitHub::SQL.new "SELECT `VALUE` FROM example_key_values" +sql = GitHub::SQL.new <<-SQL + SELECT `value` FROM example_key_values +SQL key = ENV["KEY"] unless key.nil? - sql.add "WHERE `key` = :key", key: key + sql.add <<-SQL, key: key + WHERE `key` = :key + SQL end limit = ENV["LIMIT"] unless limit.nil? - sql.add "ORDER BY `key` ASC" - sql.add "LIMIT :limit", limit: limit.to_i + sql.add <<-SQL, limit: limit.to_i + ORDER BY `key` ASC + LIMIT :limit + SQL end p sql.results ``` @@ -191,11 +204,12 @@ ## Maintainers | pic | @mention | |---|---| -| ![@jnunemaker](https://avatars3.githubusercontent.com/u/235?s=64) | [@jnunemaker](https://github.com/jnunemaker) | | ![@charliesome](https://avatars3.githubusercontent.com/u/179065?s=64) | [@charliesome](https://github.com/charliesome) | +| ![@jnunemaker](https://avatars3.githubusercontent.com/u/235?s=64) | [@jnunemaker](https://github.com/jnunemaker) | +| ![@zerowidth](https://avatars3.githubusercontent.com/u/3999?s=64) | [@zerowidth](https://github.com/zerowidth) | ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).