(envKey: string, fallback: number)
| 473 | return 'IFF(total_generation_time_ms IS NOT NULL AND usage_date >= DATEADD(day, -7, CURRENT_DATE), 1, 0)'; |
| 474 | } |
| 475 | |
| 476 | // --------------------------------------------------------------------------- |
| 477 | // Bucket expression for timeseries / table grouping |
| 478 | // --------------------------------------------------------------------------- |
| 479 | |
| 480 | /** |
| 481 | * Returns a SQL expression that formats the time column as a string bucket, |
| 482 | * matching the granularity the caller requested. |
| 483 | * |
| 484 | * Hourly → 'YYYY-MM-DD HH24:MI:SS' (matches what Postgres timestamp::text returns) |
no test coverage detected