Method: Sequel::Plugins::ColumnEncryption::DatasetMethods#with_encrypted_value

Defined in:
lib/sequel/plugins/column_encryption.rb

#with_encrypted_value(column, value) ⇒ Object

Filter the dataset to only match rows where the column contains an encrypted version of value. Only works on searchable encrypted columns.


725
726
727
728
729
730
731
732
733
734
# File 'lib/sequel/plugins/column_encryption.rb', line 725

def with_encrypted_value(column, value)
   = model.send(:column_encryption_metadata)[column]
  
  unless  && .data_searcher
    raise Error, "lookup for encrypted column #{column.inspect} is not supported"
  end

  prefixes = .data_searcher.call(value)
  where(Sequel.|(*prefixes.map{|v| Sequel.like(column, "#{escape_like(v)}%")}))
end