Sha256: 71e008f6c59eaadef24882414f664b1dbba4fae39aa1da4d3f88e6db20682935
Contents?: true
Size: 921 Bytes
Versions: 8
Compression:
Stored size: 921 Bytes
Contents
# frozen_string_literal: true require "mobility/backends/sequel/pg_query_methods" require "mobility/backends/sequel/query_methods" Sequel.extension :pg_json, :pg_json_ops module Mobility module Backends module Sequel class Container::JsonQueryMethods < QueryMethods include PgQueryMethods attr_reader :column_name def initialize(attributes, options) super @column_name = options[:column_name] define_query_methods end def matches(key, locale) build_op(column_name)[locale].get_text(key.to_s) end def exists(key, locale) matches(key, locale) !~ nil end def quote(value) value && value.to_s end private def build_op(key) ::Sequel.pg_json_op(key) end end Container.private_constant :JsonQueryMethods end end end
Version data entries
8 entries across 8 versions & 1 rubygems