Sha256: 7cfc82d95cc8251d5104ca158bfc4c15ec58ef324dfcc71f739504cab0fb0a43

Contents?: true

Size: 450 Bytes

Versions: 10

Compression:

Stored size: 450 Bytes

Contents

# frozen_string_literal: true

module LunaPark
  module Extensions
    module Repositories
      module Postgres
        module Create
          def create(input)
            entity = wrap(input)
            row    = to_row(entity)
            new_row = dataset.returning.insert(row).first
            new_attrs = from_row(new_row)
            entity.set_attributes(new_attrs)
            entity
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
luna_park-0.12.1 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.12.0 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.7 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.6 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.5 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.4 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.3 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.2 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.1 lib/luna_park/extensions/repositories/postgres/create.rb
luna_park-0.11.0 lib/luna_park/extensions/repositories/postgres/create.rb