Sha256: ae5f6e55041f584f014d9c399a234832dd703e918a4cad8127c715ec4a5a7824

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

require "sequel_mapper/identity_map"
require "sequel_mapper/dirty_map"
require "sequel_mapper/mapper_facade"
require "sequel_mapper/configurations/conventional_configuration"

module SequelMapper
  module PublicConveniencies
    def config(database_connection)
      Configurations::ConventionalConfiguration.new(database_connection)
    end

    def mapper(config:, name:, datastore:)
      dataset = datastore[config.fetch(name).namespace]
      identity_map = IdentityMap.new({})
      dirty_map = DirtyMap.new({})

      MapperFacade.new(
        mappings: config,
        mapping_name: name,
        datastore: datastore,
        dataset: dataset,
        identity_map: identity_map,
        dirty_map: dirty_map,
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sequel_mapper-0.0.3 lib/sequel_mapper/public_conveniencies.rb