Sha256: f69895354896948895dfdf7f6f54a17e82a4e8cd92517e81a122731e6dff37f1

Contents?: true

Size: 715 Bytes

Versions: 8

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true
require 'mobility/backends/sequel/pg_query_methods'
require "mobility/backends/sequel/query_methods"

Sequel.extension :pg_hstore, :pg_hstore_ops

module Mobility
  module Backends
    module Sequel
      class Hstore::QueryMethods < QueryMethods
        include PgQueryMethods

        def matches(key, locale)
          build_op(key)[locale]
        end

        def exists(key, locale)
          build_op(key).has_key?(locale)
        end

        def quote(value)
          value && value.to_s
        end

        private

        def build_op(key)
          ::Sequel.hstore_op(column_name(key))
        end
      end
      Hstore.private_constant :QueryMethods
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mobility-0.7.6 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.7.5 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.7.4 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.7.3 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.7.2 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.7.1 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.7.0 lib/mobility/backends/sequel/hstore/query_methods.rb
mobility-0.6.0 lib/mobility/backends/sequel/hstore/query_methods.rb