You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-20Lines changed: 45 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,55 +7,67 @@ If you were expecting `Exrethinkdb` you are in the right place. We decided to ch
7
7
8
8
I just set up a channel on the Elixir slack, so if you are on there join #rethinkdb.
9
9
10
-
###Recent changes
10
+
### Recent changes
11
+
12
+
#### 0.4.0
11
13
12
-
####0.4.0
13
14
* Extract Changefeed out into separate [package](https://github.com/hamiltop/rethinkdb_changefeed)
14
15
* Accept keyword options with queries
15
16
16
-
##Getting Started
17
+
##Getting Started
17
18
18
19
See [API documentation](http://hexdocs.pm/rethinkdb/) for more details.
19
20
20
-
###Connection
21
+
###Connection
21
22
22
23
Connections are managed by a process. Start the process by calling `start_link/1`. See [documentation for `Connection.start_link/1`](http://hexdocs.pm/rethinkdb/RethinkDB.Connection.html#start_link/1) for supported options.
An `RethinkDB.Connection` does parallel queries via pipelining. It can and should be shared among multiple processes. Because of this, it is common to have one connection shared in your application. To create a default connection, we create a new module and `use RethinkDB.Connection`.
49
+
43
50
```elixir
44
51
defmoduleFooDatabasedo
45
52
useRethinkDB.Connection
46
53
end
47
54
```
55
+
48
56
This connection can be supervised without a name (it will assume the module as the name).
57
+
49
58
```elixir
50
59
worker(FooDatabase, [])
51
60
```
61
+
52
62
Queries can be run without providing a connection (it will use the name connection).
63
+
53
64
```elixir
54
65
importRethinkDB.Query
55
66
table("people") |>FooDatabase.run
56
67
```
57
68
58
-
####Connection Pooling
69
+
#### Connection Pooling
70
+
59
71
To use a connection pool, add Poolboy to your dependencies:
60
72
61
73
```elixir
@@ -78,43 +90,50 @@ table("people") |> db
78
90
:poolboy.checkin(:rethinkdb_pool, db)
79
91
```
80
92
81
-
###Query
93
+
### Query
94
+
82
95
`RethinkDB.run/2` accepts a process as the second argument (to facilitate piping).
RethinkDB supports RethinkDB functions in queries. There are two approaches you can take:
101
117
102
118
Use RethinkDB operators
119
+
103
120
```elixir
104
121
importRethinkDB.Query
105
122
106
123
make_array([1,2,3]) |>map(fn (x) ->add(x, 1) end)
107
124
```
108
125
109
126
Use Elixir operators via the lambda macro
127
+
110
128
```elixir
111
129
requireRethinkDB.Lambda
112
130
importRethinkDB.Lambda
113
131
114
132
make_array([1,2,3]) |>map(lambda fn (x) -> x +1end)
115
133
```
116
134
117
-
####Map
135
+
#### Map
136
+
118
137
```elixir
119
138
requireRethinkDB.Lambda
120
139
importQuery
@@ -132,6 +151,7 @@ table("people")
132
151
See [query.ex](lib/rethinkdb/query.ex) for more basic queries. If you don't see something supported, please open an issue. We're moving fast and any guidance on desired features is helpful.
133
152
134
153
#### Indexes
154
+
135
155
```elixir
136
156
# Simple indexes
137
157
# create
@@ -156,9 +176,10 @@ result = Query.table("people")
One limitation we have in Elixir is that we don't support varargs. So in JavaScript you would do `getAll(key1, key2, {index: "uniqueness"})`. In Elixir we have to do `get_all([key1, key2], index: "uniqueness")`. With a single key it becomes `get_all([key1], index: "uniqueness")` and when `key1` is `[partA, partB]` you have to do `get_all([[partA, partB]], index: "uniqueness")`
160
181
161
-
###Changes
182
+
###Changes
162
183
163
184
Change feeds can be consumed either incrementally (by calling `RethinkDB.next/1`) or via the Enumerable Protocol.
Supervised Changefeeds (an OTP behavior for running a changefeed as a process) have been moved to their own repo to enable independent release cycles. See https://github.com/hamiltop/rethinkdb_changefeed
178
200
179
-
###Roadmap
201
+
### Roadmap
202
+
180
203
Version 1.0.0 will be limited to individual connections and implement the entire documented ReQL (as of rethinkdb 2.0)
181
204
182
205
While not provided by this library, we will also include example code for:
@@ -186,12 +209,14 @@ While not provided by this library, we will also include example code for:
186
209
The goal for 1.0.0 is to be stable. Issues have been filed for work that needs to be completed before 1.0.0 and tagged with the 1.0.0 milestone.
187
210
188
211
189
-
###Example Apps
212
+
### Example Apps
213
+
190
214
Checkout the wiki page for various [example apps](https://github.com/hamiltop/rethinkdb-elixir/wiki/Example-Apps)
191
215
216
+
### Contributing
192
217
193
-
###Contributing
194
218
Contributions are welcome. Take a look at the Issues. Anything that is tagged `Help Wanted` or `Feedback Wanted` is a good candidate for contributions. Even if you don't know where to start, respond to an interesting issue and you will be pointed in the right direction.
195
219
196
-
####Testing
220
+
#### Testing
221
+
197
222
Be intentional. Whether you are writing production code or tests, make sure there is value in the test being written.
0 commit comments