Module: WolfCore::NoSqlDbDataSource

Defined in:
lib/wolf_core/infrastructure/no_sql_db_data_source.rb

Class Method Summary collapse

Class Method Details

.get_item(table_name:, key:) ⇒ Object



20
21
22
23
24
25
# File 'lib/wolf_core/infrastructure/no_sql_db_data_source.rb', line 20

def get_item(table_name:, key:)
  instance.get_item({
    table_name: table_name,
    key: key
  }).item
end

.init(region: 'us-east-1') ⇒ Object



5
6
7
# File 'lib/wolf_core/infrastructure/no_sql_db_data_source.rb', line 5

def init(region: 'us-east-1')
  @@dynamodb_client ||= Aws::DynamoDB::Client.new(region: region)
end

.instanceObject



9
10
11
# File 'lib/wolf_core/infrastructure/no_sql_db_data_source.rb', line 9

def instance
  @@dynamodb_client
end

.put_item(table_name:, item:) ⇒ Object



13
14
15
16
17
18
# File 'lib/wolf_core/infrastructure/no_sql_db_data_source.rb', line 13

def put_item(table_name:, item:)
  instance.put_item({
    table_name: table_name,
    item: item
  })
end