Public Instance methods
needing_reencryption()
Filter the dataset to exclude rows where all encrypted columns are already encrypted with the current key and format.
[show source]
# File lib/sequel/plugins/column_encryption.rb 717 def needing_reencryption 718 incorrect_column_prefixes = model.send(:column_encryption_metadata).map do |column, metadata| 719 prefix = metadata.key_searcher.call 720 (Sequel[column] < prefix) | (Sequel[column] > prefix + 'B') 721 end 722 723 where(Sequel.|(*incorrect_column_prefixes)) 724 end
with_encrypted_value(column, value)
Filter the dataset to only match rows where the column contains an encrypted version of value. Only works on searchable encrypted columns.
[show source]
# File lib/sequel/plugins/column_encryption.rb 704 def with_encrypted_value(column, value) 705 metadata = model.send(:column_encryption_metadata)[column] 706 707 unless metadata && metadata.data_searcher 708 raise Error, "lookup for encrypted column #{column.inspect} is not supported" 709 end 710 711 prefixes = metadata.data_searcher.call(value) 712 where(Sequel.|(*prefixes.map{|v| Sequel.like(column, "#{escape_like(v)}%")})) 713 end