Sha256: 6502b5d2edf751e123c3a2b0d1d4241df2979927617088186597fe3fb0faf13b

Contents?: true

Size: 984 Bytes

Versions: 9

Compression:

Stored size: 984 Bytes

Contents

module Rasti
  module DB
    module NQL
      module FilterConditionStrategies
        module Types
          class SQLiteArray

            def self.equal(identifier, values)
              array = values.map { |value| "\"#{value}\"" }.join(',')
              {identifier => "[#{array}]"}
            end

            def self.not_equal(identifier, values)
              Sequel.|(*values.map { |value| ~Sequel.like(identifier, "%\"#{value}\"%") })
            end

            def self.like(identifier, values)
              Sequel.|(*values.map { |value| Sequel.like(identifier, "%#{value}%") })
            end

            def self.include(identifier, values)
              Sequel.|(*values.map { |value| Sequel.like(identifier, "%\"#{value}\"%") })
            end

            def self.not_include(identifier, values)
              Sequel.&(*values.map { |value| ~Sequel.like(identifier, "%\"#{value}\"%") })
            end

          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rasti-db-4.2.0 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-4.1.1 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-4.1.0 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-4.0.0 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-3.0.0 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-2.3.3 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-2.3.2 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-2.3.1 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb
rasti-db-2.3.0 lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb