Sha256: 41ce09ec6fb89c3e0d9ba6b244ec4a1be0cfb45a2b9579dcc844767a42fc8645

Contents?: true

Size: 380 Bytes

Versions: 1

Compression:

Stored size: 380 Bytes

Contents

module FilterParam
  module Operators
    class StartsWith < FieldFilterOperator
      operator_tag :sw
      operand_data_type :string

      def self.sql(field, literal)
        super

        pattern = "#{literal.value}%"

        "#{field.actual_name} LIKE #{sql_quote(pattern)}"
      end
    end
  end
end

FilterParam::Operator.register(FilterParam::Operators::StartsWith)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filter_param-0.1.2 lib/filter_param/operators/starts_with.rb