Class: Bas::SharedStorage::Postgres
- Defined in:
- lib/bas/shared_storage/postgres.rb
Overview
The SharedStorage::Postgres class serves as a shared storage implementation to read and write on a shared storage defined as a postgres database
Constant Summary collapse
- TABLE_PARAMS =
"data, tag, archived, stage, status, error_message, version"
Instance Attribute Summary
Attributes inherited from Base
#read_options, #read_response, #write_options, #write_response
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Bas::SharedStorage::Base
Instance Method Details
permalink #read ⇒ Object
[View source]
19 20 21 22 23 24 25 26 |
# File 'lib/bas/shared_storage/postgres.rb', line 19 def read params = { connection: [:connection], query: read_query } first_result = Utils::Postgres::Request.execute(params).first || {} @read_response = Bas::SharedStorage::Types::Read.new(first_result[:id], first_result[:data], first_result[:inserted_at]) end |
permalink #set_in_process ⇒ Object
[View source]
33 34 35 36 37 |
# File 'lib/bas/shared_storage/postgres.rb', line 33 def set_in_process return if [:avoid_process].eql?(true) || read_response.id.nil? update_stage(read_response.id, "in process") end |
permalink #set_processed ⇒ Object
[View source]
39 40 41 42 43 |
# File 'lib/bas/shared_storage/postgres.rb', line 39 def set_processed return if [:avoid_process].eql?(true) || read_response.id.nil? update_stage(read_response.id, "processed") unless @read_response.nil? end |