Sha256: 99cc8574c12653d98e03fe645e944f07076e06567b3037005c7f16b265bae79b
Contents?: true
Size: 1.62 KB
Versions: 10
Compression:
Stored size: 1.62 KB
Contents
# frozen_string_literal: true require 'valkyrie/persistence/postgres/persister' require 'valkyrie/persistence/postgres/query_service' module Valkyrie::Persistence::Postgres # 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. # # @see https://github.com/samvera-labs/valkyrie/wiki/Set-up-Valkyrie-database-in-a-Rails-Application class MetadataAdapter # @return [Class] {Valkyrie::Persistence::Postgres::Persister} def persister Valkyrie::Persistence::Postgres::Persister.new(adapter: self) end # @return [Class] {Valkyrie::Persistence::Postgres::QueryService} def query_service @query_service ||= Valkyrie::Persistence::Postgres::QueryService.new( resource_factory: resource_factory, adapter: self ) end # @return [Class] {Valkyrie::Persistence::Postgres::ResourceFactory} def resource_factory @resource_factory ||= Valkyrie::Persistence::Postgres::ResourceFactory.new(adapter: self) end # Construct a Valkyrie ID object using an MD5 hash generated from the database URL # @return [Valkyrie::ID] def id @id ||= begin to_hash = "#{resource_factory.orm_class.connection_config['host']}:#{resource_factory.orm_class.connection_config['database']}" Valkyrie::ID.new(Digest::MD5.hexdigest(to_hash)) end end def standardize_query_result? Valkyrie.warn_about_standard_queries! if Valkyrie.config.standardize_query_result != true Valkyrie.config.standardize_query_result == true end end end
Version data entries
10 entries across 10 versions & 1 rubygems