module Doorkeeper::Models::ExpirationTimeSqlMath::ClassMethods

def adapter_name

def adapter_name
  ActiveRecord::Base.connection.adapter_name
end

def expiration_time_sql

def expiration_time_sql
  if respond_to?(:custom_expiration_time_sql)
    custom_expiration_time_sql
  else
    expiration_time_sql_expression
  end
end

def expiration_time_sql_expression

def expiration_time_sql_expression
  ADAPTERS_MAPPING.fetch(adapter_name.downcase).new(self).generate_sql
end

def supports_expiration_time_math?

def supports_expiration_time_math?
  ADAPTERS_MAPPING.key?(adapter_name.downcase) ||
    respond_to?(:custom_expiration_time_sql)
end