Class: LlmCostTracker::Ledger::Rollups::UpsertSql
- Inherits:
-
Object
- Object
- LlmCostTracker::Ledger::Rollups::UpsertSql
- Defined in:
- lib/llm_cost_tracker/ledger/rollups/upsert_sql.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(model) ⇒ UpsertSql
constructor
A new instance of UpsertSql.
Constructor Details
#initialize(model) ⇒ UpsertSql
Returns a new instance of UpsertSql.
13 14 15 |
# File 'lib/llm_cost_tracker/ledger/rollups/upsert_sql.rb', line 13 def initialize(model) @model = model end |
Class Method Details
.call(model) ⇒ Object
9 10 11 |
# File 'lib/llm_cost_tracker/ledger/rollups/upsert_sql.rb', line 9 def self.call(model) new(model).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 |
# File 'lib/llm_cost_tracker/ledger/rollups/upsert_sql.rb', line 17 def call return Arel.sql(mysql_sql) if Ledger::Schema::Adapter.mysql?(connection) return Arel.sql(postgres_sql) if Ledger::Schema::Adapter.postgresql?(connection) Ledger::Schema::Adapter.ensure_supported!(connection) end |