Module: LlmCostTracker::ActiveRecordAdapter
- Defined in:
- lib/llm_cost_tracker/active_record_adapter.rb
Constant Summary collapse
- MYSQL_ADAPTERS =
%w[ ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter ActiveRecord::ConnectionAdapters::Mysql2Adapter ActiveRecord::ConnectionAdapters::TrilogyAdapter ].freeze
- POSTGRESQL_ADAPTERS =
%w[ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter ].freeze
- SQLITE_ADAPTERS =
%w[ ActiveRecord::ConnectionAdapters::SQLite3Adapter ].freeze
- MYSQL_PATTERN =
/mysql|trilogy|mariadb/i- POSTGRESQL_PATTERN =
/postgres/i- SQLITE_PATTERN =
/sqlite/i
Class Method Summary collapse
Class Method Details
.mysql?(value) ⇒ Boolean
21 |
# File 'lib/llm_cost_tracker/active_record_adapter.rb', line 21 def mysql?(value) = adapter_instance?(value, MYSQL_ADAPTERS) || adapter_name(value).match?(MYSQL_PATTERN) |
.postgresql?(value) ⇒ Boolean
23 24 25 |
# File 'lib/llm_cost_tracker/active_record_adapter.rb', line 23 def postgresql?(value) adapter_instance?(value, POSTGRESQL_ADAPTERS) || adapter_name(value).match?(POSTGRESQL_PATTERN) end |
.sqlite?(value) ⇒ Boolean
27 |
# File 'lib/llm_cost_tracker/active_record_adapter.rb', line 27 def sqlite?(value) = adapter_instance?(value, SQLITE_ADAPTERS) || adapter_name(value).match?(SQLITE_PATTERN) |