Sha256: 8ac67f8f2d296a7ffcaa4760d7eaad41779a5944b8a53b4913fe52feb472f5f6

Contents?: true

Size: 836 Bytes

Versions: 41

Compression:

Stored size: 836 Bytes

Contents

module PactBroker
  module Repositories
    module Helpers

      extend self

      def name_like column_name, value
        Sequel.like(column_name, value, case_sensitivity_options)
      end

      def case_sensitivity_options
        {case_insensitive: !PactBroker.configuration.use_case_sensitive_resource_names}
      end

      def order_ignore_case column_name = :name
        order(Sequel.function(:lower, column_name))
      end

      def mysql?
        Sequel::Model.db.adapter_scheme.to_s =~ /mysql/
      end

      def select_all_qualified
        select(Sequel[model.table_name].*)
      end

      def select_for_subquery column
        if mysql? #stoopid mysql doesn't allow subqueries
          select(column).collect{ | it | it[column] }
        else
          select(column)
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
pact_broker-2.24.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.23.4 lib/pact_broker/repositories/helpers.rb
pact_broker-2.23.3 lib/pact_broker/repositories/helpers.rb
pact_broker-2.23.2 lib/pact_broker/repositories/helpers.rb
pact_broker-2.23.1 lib/pact_broker/repositories/helpers.rb
pact_broker-2.23.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.22.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.21.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.20.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.19.2 lib/pact_broker/repositories/helpers.rb
pact_broker-2.19.1 lib/pact_broker/repositories/helpers.rb
pact_broker-2.19.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.18.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.17.1 lib/pact_broker/repositories/helpers.rb
pact_broker-2.17.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.16.1 lib/pact_broker/repositories/helpers.rb
pact_broker-2.16.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.15.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.14.0 lib/pact_broker/repositories/helpers.rb
pact_broker-2.13.1 lib/pact_broker/repositories/helpers.rb