db_fuel 1.1.0.pre.alpha.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +4 -3
- data/lib/db_fuel/library/active_record/find_or_insert.rb +1 -1
- data/lib/db_fuel/library/active_record/insert.rb +1 -1
- data/lib/db_fuel/library/active_record/update.rb +1 -1
- data/lib/db_fuel/modeling/keyed_column.rb +2 -2
- data/lib/db_fuel/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e2fc7d0ced8034053e409df7d34fa7127e21e357454221ad0262a59cc5bf2be
|
4
|
+
data.tar.gz: 6b2ce0fd3f4b6661f84820bb2394e49e1e11b111d3df02ce7981996b1eae386e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73019f998b6db2d10d397e017ab5764dae1e7f4c42ceac403c0a345d91d21fe9da680a46a512a7dad0de85e0a731d6b81bffa0bfab85e7d9b6ca4912c571f0b0
|
7
|
+
data.tar.gz: f0e9b1e9dc28d29659c8532ef39229a8fa7e13c37f2476a75b37dbb62a46469e96ba6916a3eb0df1cc7cdb392c63031271443c0ab54d6933b8c7985f3fcb871b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -24,8 +24,8 @@ Refer to the [Burner](https://github.com/bluemarblepayroll/burner) library for m
|
|
24
24
|
|
25
25
|
### ActiveRecord Jobs
|
26
26
|
|
27
|
-
* **db_fuel/active_record/find_or_insert** [table_name, attributes, debug, primary_key, register, separator, timestamps, unique_attributes]: An extension of the `db_fuel/active_record/insert` job that adds an existence check before
|
28
|
-
* **db_fuel/active_record/insert** [table_name, attributes, debug, primary_key, register, separator, timestamps]: This job can take the objects in a register and insert them into a database table. Attributes defines which object properties to convert to SQL. Refer to the class and constructor specification for more detail.
|
27
|
+
* **db_fuel/active_record/find_or_insert** [table_name, attributes, debug, primary_key, register, separator, timestamps, unique_attributes]: An extension of the `db_fuel/active_record/insert` job that adds an existence check before SQL insertion. The `unique_attributes` will be converted to WHERE clauses for performing the existence check.
|
28
|
+
* **db_fuel/active_record/insert** [table_name, attributes, debug, primary_key, register, separator, timestamps]: This job can take the objects in a register and insert them into a database table. If primary_key is specified then its key will be set to the primary key. Note that composite primary keys are not supported. Attributes defines which object properties to convert to SQL. Refer to the class and constructor specification for more detail.
|
29
29
|
* **db_fuel/active_record/update** [table_name, attributes, debug, register, separator, timestamps, unique_attributes]: This job can take the objects in a register and updates them within a database table. Attributes defines which object properties to convert to SQL SET clauses while unique_attributes translate to WHERE clauses. Refer to the class and constructor specification for more detail.
|
30
30
|
|
31
31
|
### Dbee Jobs
|
@@ -194,11 +194,12 @@ There should now be two new patients, AB0 and AB1, present in the table `patient
|
|
194
194
|
Notes:
|
195
195
|
|
196
196
|
* Since we specified the `primary_key`, the records' `id` attributes should be set to their respective primary key values.
|
197
|
+
* Composite primary keys are not currently supported.
|
197
198
|
* Set `debug: true` to print out each INSERT statement in the output (not for production use.)
|
198
199
|
|
199
200
|
#### Inserting Only New Records
|
200
201
|
|
201
|
-
Another job `db_fuel/active_record/find_or_insert` allows for an existence check to performed each insertion. If a record is found then it will not insert the record. If `primary_key` is set then the existence check will also still set the primary key on the payload's respective object. We can build on the above insert example for only inserting new patients if their chart_number is unique:
|
202
|
+
Another job `db_fuel/active_record/find_or_insert` allows for an existence check to performed each insertion. If a record is found then it will not insert the record. If `primary_key` is set then the existence check will also still set the primary key on the payload's respective object. Note that composite primary keys are not currently supported. We can build on the above insert example for only inserting new patients if their chart_number is unique:
|
202
203
|
|
203
204
|
````ruby
|
204
205
|
pipeline = {
|
@@ -29,7 +29,7 @@ module DbFuel
|
|
29
29
|
#
|
30
30
|
# attributes: Used to specify which object properties to put into the
|
31
31
|
# SQL statement and also allows for one last custom transformation
|
32
|
-
# pipeline, in case the data calls for
|
32
|
+
# pipeline, in case the data calls for SQL-specific transformers
|
33
33
|
# before insertion.
|
34
34
|
#
|
35
35
|
# debug: If debug is set to true (defaults to false) then the SQL statements and
|
@@ -26,7 +26,7 @@ module DbFuel
|
|
26
26
|
#
|
27
27
|
# attributes: Used to specify which object properties to put into the
|
28
28
|
# SQL statement and also allows for one last custom transformation
|
29
|
-
# pipeline, in case the data calls for
|
29
|
+
# pipeline, in case the data calls for SQL-specific transformers
|
30
30
|
# before insertion.
|
31
31
|
#
|
32
32
|
# debug: If debug is set to true (defaults to false) then the SQL statements and
|
@@ -28,7 +28,7 @@ module DbFuel
|
|
28
28
|
#
|
29
29
|
# attributes: Used to specify which object properties to put into the
|
30
30
|
# SQL statement and also allows for one last custom transformation
|
31
|
-
# pipeline, in case the data calls for
|
31
|
+
# pipeline, in case the data calls for SQL-specific transformers
|
32
32
|
# before mutation.
|
33
33
|
#
|
34
34
|
# debug: If debug is set to true (defaults to false) then the SQL statements and
|
@@ -9,9 +9,9 @@
|
|
9
9
|
|
10
10
|
module DbFuel
|
11
11
|
module Modeling
|
12
|
-
# Connects a hash key to a
|
12
|
+
# Connects a hash key to a SQL column. By default if a column is not given then its
|
13
13
|
# key will be used for both. The general use case for this is for mapping objects
|
14
|
-
# to
|
14
|
+
# to SQL and SQL to objects.
|
15
15
|
class KeyedColumn
|
16
16
|
acts_as_hashable
|
17
17
|
|
data/lib/db_fuel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_fuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -268,9 +268,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: '2.5'
|
269
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
270
|
requirements:
|
271
|
-
- - "
|
271
|
+
- - ">="
|
272
272
|
- !ruby/object:Gem::Version
|
273
|
-
version:
|
273
|
+
version: '0'
|
274
274
|
requirements: []
|
275
275
|
rubygems_version: 3.0.3
|
276
276
|
signing_key:
|