Sha256: b01c515c84ae0163412409d7521bae169d23bb4dd098b4060f6839fb8c9f109b
Contents?: true
Size: 749 Bytes
Versions: 2
Compression:
Stored size: 749 Bytes
Contents
module Koine module Repository class Repository module IdAwareEntity def find(id) data = storage.find_one_by(id: id) return data unless data entity = new_entity hydrate(data, entity) entity end def create(entity) values = hydrator.extract(entity) values.delete("id") values.delete(:id) entity.id = storage.insert(values) end def update(entity) values = hydrator.extract(entity) values.delete(:id) storage.update_where({ id: entity.id }, values) end def remove(entity) storage.delete_where({ id: entity.id }) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
koine-repository-1.1.1 | lib/koine/repository/repository/id_aware_entity.rb |
koine-repository-1.1 | lib/koine/repository/repository/id_aware_entity.rb |