Class: Valkyrie::Persistence::Postgres::MetadataAdapter
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Postgres::MetadataAdapter
- Defined in:
- lib/valkyrie/persistence/postgres/metadata_adapter.rb
Overview
Metadata Adapter for Postgres Adapter.
This adapter uses ActiveRecord to persist resources in a JSON-B column named ‘metadata`. This requires setting up a database.
Instance Method Summary collapse
-
#id ⇒ Valkyrie::ID
Construct a Valkyrie ID object using an MD5 hash generated from the database URL.
- #persister ⇒ Class
- #query_service ⇒ Class
- #resource_factory ⇒ Class
Instance Method Details
#id ⇒ Valkyrie::ID
Construct a Valkyrie ID object using an MD5 hash generated from the database URL
32 33 34 35 36 37 |
# File 'lib/valkyrie/persistence/postgres/metadata_adapter.rb', line 32 def id @id ||= begin to_hash = "#{connection_configuration[:host]}:#{connection_configuration[:database]}" Valkyrie::ID.new(Digest::MD5.hexdigest(to_hash)) end end |
#persister ⇒ Class
Returns Persister.
13 14 15 |
# File 'lib/valkyrie/persistence/postgres/metadata_adapter.rb', line 13 def persister Valkyrie::Persistence::Postgres::Persister.new(adapter: self) end |
#query_service ⇒ Class
Returns QueryService.
18 19 20 21 22 23 |
# File 'lib/valkyrie/persistence/postgres/metadata_adapter.rb', line 18 def query_service @query_service ||= Valkyrie::Persistence::Postgres::QueryService.new( resource_factory: resource_factory, adapter: self ) end |
#resource_factory ⇒ Class
Returns ResourceFactory.
26 27 28 |
# File 'lib/valkyrie/persistence/postgres/metadata_adapter.rb', line 26 def resource_factory @resource_factory ||= Valkyrie::Persistence::Postgres::ResourceFactory.new(adapter: self) end |