rethinkdb_helper 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c7050a7a77d22a393fcc4b88452ae20146867fc
4
- data.tar.gz: 584a217453b2d1c644b206c1e7ffc6fb783edfe1
3
+ metadata.gz: aee5dc88365446d4f305df51654cf45c28e8ae18
4
+ data.tar.gz: d39c3f9b09416b9b96c6a30927d2ab03e348a0f6
5
5
  SHA512:
6
- metadata.gz: 33f11b396b13dae5c7f366af664d8d6cb3c82323bb4cecca753b111a4726c2de6b9363d817c667d8ed1d0569eb97339fb03310b8ff519788a2b69dfca910b9aa
7
- data.tar.gz: 76fc8386bf4c5460cbd53f00990b8b1bf67fca5ad5bb3d9e26b1cf5b4038aadfd92518625123622d58a66da3d14aceaf89ed299426f24b678281c7c037fede9e
6
+ metadata.gz: d84a17a4f2faade25da3e2a3eb3d94c55c2e6f4f324540b92763e73d6f651fbfdb53a8c56d4cf2023358f697fb35faaae09bc43ecebf1204b0127908fd4b6a1a
7
+ data.tar.gz: 2070bdde98f9332fcca53bdf8985abdbdc02ec2ffc166f4b0a11346dea3ce436c0e44b20468ebe283cc5677500c6cb71782469440946c5771da01da5a2d11df7
data/README.md CHANGED
@@ -4,6 +4,14 @@ My convention as a wrapper around the rethinkdb gem.
4
4
  Under Development.
5
5
  Don't use it.
6
6
 
7
+ This class is oriented around exploring the rethinkdb API.
8
+
9
+ I have not looked at the nobrainer gem yet. You ought to.
10
+
11
+ The rethinkdb-cli gem looks pretty simple. I'm thinking
12
+ about putting a REPL into this helper gem as well. Maybe
13
+ at a bin directory with a cli program that invokes the REPL.
14
+
7
15
  ## Installation
8
16
 
9
17
  Add this line to your application's Gemfile:
@@ -28,25 +36,34 @@ Or install it yourself as:
28
36
  port: 28015, # default
29
37
  db: 'test', # default
30
38
  table: 'test', # default
39
+ drop: false, # default - drop/delete the db
31
40
  create_if_missing: true # created db/table if they are missing
32
41
  )
33
- db.insert(json_documents) # takes array of hashes or json
34
- cursor = db.search(:field_name, field_value_regex)
35
- puts cursor.count
42
+ options={}
43
+ db.insert([Hash, Hash, Hash ...], options) # takes array of hashes or json
44
+ cursor = db.search(field_name: field_value_regex)
36
45
  cursor.each {|d| ap d}
37
46
  etc.
38
47
  ```
39
48
 
40
- ## Development
49
+ If you were to insert an actual JSON string it would not work. Of course
50
+ being a wrapper and all that I could check the class and IF STRING then
51
+ ASSUME its a JSON string then do a JSON.parse on it to get a Hash to
52
+ pass to the native (sic.) #insert method of the rethinkdb.
41
53
 
42
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
54
+ Sometimes you must use symbols
55
+ to access to the (Hash) document's fields. Other times in other methods the
56
+ field name must be a string. Go figure.
57
+
58
+
59
+ ## Development
43
60
 
44
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
61
+ ** Insert Fun Here **
45
62
 
46
63
  ## Contributing
47
64
 
48
- 1. Fork it ( https://github.com/[my-github-username]/rethinkdb_helper/fork )
49
- 2. Create your feature branch (`git checkout -b my-new-feature`)
65
+ 1. Fork it ( https://github.com/MadBomber/rethinkdb_helper/fork )
66
+ 2. Create your feature branch (`git checkout -b new-feature`)
50
67
  3. Commit your changes (`git commit -am 'Add some feature'`)
51
- 4. Push to the branch (`git push origin my-new-feature`)
68
+ 4. Push to the branch (`git push origin new-feature`)
52
69
  5. Create a new Pull Request
@@ -5,6 +5,7 @@
5
5
  ## By: Dewayne VanHoozer (dvanhoozer@gmail.com)
6
6
  #
7
7
  # TODO: Review the nobrainer gem to see if this stuff is moot
8
+ # TODO: Reorganize the methods into separate files within lib
8
9
  #
9
10
 
10
11
  require 'forwardable'
@@ -29,15 +30,10 @@ class RethinkdbHelper
29
30
  # connect, db, table
30
31
  #def_delegators :r, :connect, :db, :table
31
32
 
32
- # TODO: Pass some methods to @commection for fulfillment
33
- # close, reconnect, use, noreply_wait
34
33
  def_delegators :@connection, :close, :reconnect, :use, :noreply_wait
35
34
 
36
- # TODO: Pass some methods to @table for fulfillment
37
- # filter, get, get_all, between, eq_join,
38
- # inner_join, outer_join
39
35
  def_delegators :@table, :filter, :get, :get_all, :between, :eq_join,
40
- :inner_join, :outer_join
36
+ :inner_join, :outer_join, :index_create
41
37
 
42
38
  # TODO: Limited to one table per instance, consider
43
39
  # support for multiple table per db support;
@@ -140,7 +136,7 @@ class RethinkdbHelper
140
136
  alias :flush :sync
141
137
 
142
138
 
143
- def table_create(table_name=@ooptions[:table], options={})
139
+ def table_create(table_name=@options[:table], options={})
144
140
  @table = r.table_create(table_name, options).run
145
141
  end
146
142
  alias :create_table :table_create
@@ -161,6 +157,11 @@ class RethinkdbHelper
161
157
  db_list.include?(db_name)
162
158
  end
163
159
 
160
+ def db_create(db_name=@options[:db])
161
+ @db = r.db_create(db_name).run
162
+ end
163
+ alias :create_db :db_create
164
+
164
165
  def db_list
165
166
  r.db_list.run
166
167
  end
@@ -182,10 +183,9 @@ class RethinkdbHelper
182
183
  alias :wait_for_index :index_wait
183
184
  alias :wait_index :index_wait
184
185
 
185
- def index_create(index_name, index_function=nil, options={})
186
- @table.index_create(index_name, index_funciton, options).run
186
+ def create_simple_index(field_name)
187
+ @table.index_create(field_name.to_s).run
187
188
  end
188
- alias :create_index :index_create
189
189
 
190
190
  def index_list
191
191
  @table.index_list.run
@@ -199,6 +199,11 @@ class RethinkdbHelper
199
199
  alias :delete_index :index_drop
200
200
  alias :index_delete :index_drop
201
201
 
202
+ def index_wait(index_name)
203
+ @table.index_wait(index_name).run
204
+ end
205
+ alias :wait_on_index :index_wait
206
+
202
207
  def drop?
203
208
  @options[:drop]
204
209
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rethinkdb_helper"
7
- spec.version = '0.0.2'
7
+ spec.version = '0.0.3'
8
8
  spec.authors = ["Dewayne VanHoozer"]
9
9
  spec.email = ["dvanhoozer@gmail.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rethinkdb_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-21 00:00:00.000000000 Z
11
+ date: 2015-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler