|
|
@ -59,6 +59,26 @@ row.commit(transaction) |
|
|
|
row.sync # true if synchronization successful |
|
|
|
``` |
|
|
|
|
|
|
|
### Explicitly request an existing row or explicitly creating a new row |
|
|
|
|
|
|
|
```ruby |
|
|
|
#... |
|
|
|
row = Table.create({"pk1" => "new", "pk2" => "something", ...}) # returns nil if row exists |
|
|
|
|
|
|
|
row = Table.get({"pk1" => "new", "pk2" => "something", ...}) # returns nil if row does not exist |
|
|
|
``` |
|
|
|
|
|
|
|
### Mapping results of a query to objects of a table |
|
|
|
|
|
|
|
```ruby |
|
|
|
rows = Table.map("SELECT * FROM table_name WHERE row > 4 # AND ...") |
|
|
|
pp rows |
|
|
|
|
|
|
|
#=>[<Table:0x000055da208232c8 @data={"row" => 5, ...}>, |
|
|
|
# <Table:0x00001238989cc89d @data={"row" => 7, ...}>, |
|
|
|
# ...] |
|
|
|
``` |
|
|
|
|
|
|
|
And that's really about it. |
|
|
|
|
|
|
|
## Installation |
|
|
|