postjob 0.2.1 → 0.2.2

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: bb21c1c9b0516371bbc43a2bd7229984ef7577a1
4
- data.tar.gz: 761098539e9811bfc9976d5364082030123e646e
3
+ metadata.gz: b1ab40be9d1e5d2a5dce344ed912d837bf3ae567
4
+ data.tar.gz: 09ee97d4ce95a137525d8efee7e0f7c24a21cb95
5
5
  SHA512:
6
- metadata.gz: c23429e34021916aaa70ae98643b6f270c9580b63d68153bb765532bb768125a455ac6ff00a4dd2a6bf78a89c24603440be5334bc59e4e7f75137ee06e41aa73
7
- data.tar.gz: f655e34b2746d8202613712ac70db55a094d0d8b9d996a4512ce86c3c8414cb43e8ce9eddd7983dc63966b1a4ccc77b50b70a3993e2ad31a1637b59dc04ec9a7
6
+ metadata.gz: 2930f208eb34cda94e2570a823f4d32132e6ba58c078a24d0f0803c7bbccf8068b51d3832779a1e1b7eb4c40c0034f1e951970e847bcd1f73806582f3031c735
7
+ data.tar.gz: 15ee51d44d1341b538808e4cb875a1c98cb518c34e68b355ef678860de8d1737ee20197fe49dd627d84b4b8803b928714df9a73e60b0a0074548cc930db4d1db
@@ -74,7 +74,7 @@ module Postjob::CLI
74
74
  def ps_show(id, *ids)
75
75
  ids = ([id] + ids).map { |s| Integer(s) }
76
76
 
77
- jobs = Simple::SQL.records <<~SQL, ids, into: Postjob::Job
77
+ jobs = Simple::SQL.all <<~SQL, ids, into: Postjob::Job
78
78
  SELECT * FROM postjob.postjobs WHERE id = ANY($1)
79
79
  SQL
80
80
 
@@ -111,7 +111,7 @@ module Postjob::CLI
111
111
 
112
112
  def print_sql(limit:, query:)
113
113
  connect_to_database!
114
- records = Simple::SQL.records("#{query} LIMIT $1+1", limit)
114
+ records = Simple::SQL.all("#{query} LIMIT $1+1", limit, into: Hash)
115
115
 
116
116
  tp records[0, limit]
117
117
  if records.length > limit
@@ -6,14 +6,14 @@ end
6
6
  module Postjob::Queue::Search
7
7
  extend self
8
8
 
9
- def one(id, filter: {}, into: nil)
9
+ def one(id, filter: {}, into: Hash)
10
10
  query = query(page: 0, per: 1, filter: filter, id: id)
11
- Simple::SQL.record(query, into: into)
11
+ Simple::SQL.ask(query, into: into)
12
12
  end
13
13
 
14
- def all(page: 0, per: 100, filter: {}, into: nil)
14
+ def all(page: 0, per: 100, filter: {}, into: Hash)
15
15
  query = query(page: page, per: per, filter: filter)
16
- Simple::SQL.records(query, into: into)
16
+ Simple::SQL.all(query, into: into)
17
17
  end
18
18
 
19
19
  private
data/lib/postjob/queue.rb CHANGED
@@ -90,7 +90,7 @@ module Postjob::Queue
90
90
 
91
91
  Notifications.notify_listeners
92
92
 
93
- SQL.record "SELECT * FROM #{TABLE_NAME} WHERE id=$1", id, into: Job
93
+ SQL.ask "SELECT * FROM #{TABLE_NAME} WHERE id=$1", id, into: Job
94
94
  end
95
95
  end
96
96
 
@@ -212,7 +212,7 @@ module Postjob::Queue
212
212
  def childjobs(parent)
213
213
  expect! parent => Job
214
214
 
215
- SQL.records <<~SQL, parent.id, into: Job
215
+ SQL.all <<~SQL, parent.id, into: Job
216
216
  SELECT * FROM #{TABLE_NAME}
217
217
  WHERE parent_id=$1
218
218
  ORDER BY id
@@ -222,7 +222,7 @@ module Postjob::Queue
222
222
  def next_unresolved_childjob(parent)
223
223
  expect! parent => Job
224
224
 
225
- SQL.record <<~SQL, parent.id, into: Job
225
+ SQL.ask <<~SQL, parent.id, into: Job
226
226
  SELECT * FROM #{TABLE_NAME}
227
227
  WHERE parent_id=$1 AND status NOT IN ('ok', 'failed')
228
228
  ORDER BY next_run_at
@@ -235,7 +235,7 @@ module Postjob::Queue
235
235
 
236
236
  workflow, workflow_method = parse_workflow(workflow)
237
237
 
238
- job = SQL.record <<~SQL, parent.id, workflow, workflow_method, Encoder.encode(args), into: Job
238
+ job = SQL.ask <<~SQL, parent.id, workflow, workflow_method, Encoder.encode(args), into: Job
239
239
  SELECT * FROM #{TABLE_NAME}
240
240
  WHERE parent_id=$1
241
241
  AND workflow=$2
@@ -291,7 +291,7 @@ module Postjob::Queue
291
291
  SQL
292
292
 
293
293
  SQL.transaction do
294
- job = SQL.record sql, Postjob::Registry.workflows_with_versions, into: Job
294
+ job = SQL.ask sql, Postjob::Registry.workflows_with_versions, into: Job
295
295
  yield job if job
296
296
  job
297
297
  end
@@ -307,7 +307,7 @@ module Postjob::Queue
307
307
  end
308
308
 
309
309
  def find_job_by_token(token)
310
- SQL.record <<~SQL, token, into: Job
310
+ SQL.ask <<~SQL, token, into: Job
311
311
  SELECT postjob.postjobs.* FROM postjob.postjobs
312
312
  INNER JOIN postjob.tokens ON postjob.tokens.postjob_id=postjob.postjobs.id
313
313
  WHERE postjob.tokens.token=$1
@@ -8,15 +8,15 @@ module TestHelper
8
8
  end
9
9
 
10
10
  def newest_job
11
- Simple::SQL.record "SELECT * FROM postjobs ORDER BY id DESC", into: Postjob::Job
11
+ Simple::SQL.ask "SELECT * FROM postjobs ORDER BY id DESC", into: Postjob::Job
12
12
  end
13
13
 
14
14
  def load_job(id_or_sql, *args)
15
15
  case id_or_sql
16
16
  when Integer
17
- Simple::SQL.record "SELECT * FROM postjobs WHERE id=$1", id_or_sql, into: Postjob::Job
17
+ Simple::SQL.ask "SELECT * FROM postjobs WHERE id=$1", id_or_sql, into: Postjob::Job
18
18
  else
19
- Simple::SQL.record id_or_sql, *args, into: Postjob::Job
19
+ Simple::SQL.ask id_or_sql, *args, into: Postjob::Job
20
20
  end
21
21
  end
22
22
 
@@ -27,7 +27,7 @@ module TestHelper
27
27
  def print_sql(sql, *args)
28
28
  require "table_print"
29
29
 
30
- records = Simple::SQL.records(sql, *args)
30
+ records = Simple::SQL.all(sql, *args)
31
31
  tp records
32
32
  end
33
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
@@ -120,20 +120,20 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.2'
123
+ version: '0.3'
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: 0.2.5
126
+ version: 0.3.7
127
127
  type: :runtime
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '0.2'
133
+ version: '0.3'
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: 0.2.5
136
+ version: 0.3.7
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: simple-cli
139
139
  requirement: !ruby/object:Gem::Requirement