Module: YADM

Defined in:
lib/yadm.rb,
lib/yadm/query.rb,
lib/yadm/entity.rb,
lib/yadm/mapper.rb,
lib/yadm/mapping.rb,
lib/yadm/version.rb,
lib/yadm/adapters.rb,
lib/yadm/criteria.rb,
lib/yadm/repository.rb,
lib/yadm/identity_map.rb,
lib/yadm/adapters/mysql.rb,
lib/yadm/criteria/limit.rb,
lib/yadm/criteria/order.rb,
lib/yadm/adapters/memory.rb,
lib/yadm/adapters/sqlite.rb,
lib/yadm/criteria_parser.rb,
lib/yadm/criteria/argument.rb,
lib/yadm/mapping/attribute.rb,
lib/yadm/criteria/attribute.rb,
lib/yadm/criteria/condition.rb,
lib/yadm/adapters/common_sql.rb,
lib/yadm/adapters/postgresql.rb,
lib/yadm/criteria/expression.rb,
lib/yadm/criteria_parser/expression_parser.rb

Defined Under Namespace

Modules: Adapters, Entity, Repository Classes: Criteria, CriteriaParser, IdentityMap, Mapper, Mapping, Query

Constant Summary collapse

VERSION =
'0.1'

Class Method Summary collapse

Class Method Details

.data_source(name, adapter:, **connection_params) ⇒ Object


18
19
20
21
# File 'lib/yadm.rb', line 18

def data_source(name, adapter:, **connection_params)
  data_source = Adapters.fetch(adapter).new(connection_params)
  data_sources[name] = IdentityMap.new(data_source)
end

.data_sourcesObject


31
32
33
# File 'lib/yadm.rb', line 31

def data_sources
  @data_sources ||= {}
end

.map(&block) ⇒ Object


23
24
25
# File 'lib/yadm.rb', line 23

def map(&block)
  mapper.instance_eval(&block) unless block.nil?
end

.mapperObject


35
36
37
# File 'lib/yadm.rb', line 35

def mapper
  @mapper ||= Mapper.new
end

.migrate(data_source_name, &block) ⇒ Object


27
28
29
# File 'lib/yadm.rb', line 27

def migrate(data_source_name, &block)
  data_sources.fetch(data_source_name).migrate(block)
end

.setup(&block) ⇒ Object


14
15
16
# File 'lib/yadm.rb', line 14

def setup(&block)
  instance_eval(&block) unless block.nil?
end