{
  "db_name": "PostgreSQL",
  "query": "\n            SELECT COALESCE(SUM(\n                CASE WHEN transaction_type IN ('admin_grant', 'purchase') THEN amount ELSE -amount END\n            ), 0) as \"sum!\"\n            FROM (\n                SELECT transaction_type, amount\n                FROM credits_transactions\n                WHERE user_id = $1\n                  AND ($3::timestamptz IS NULL OR created_at >= $3)\n                  AND ($4::timestamptz IS NULL OR created_at <= $4)\n                ORDER BY seq DESC\n                LIMIT $2\n            ) recent\n            ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "sum!",
        "type_info": "Numeric"
      }
    ],
    "parameters": {
      "Left": [
        "Uuid",
        "Int8",
        "Timestamptz",
        "Timestamptz"
      ]
    },
    "nullable": [
      null
    ]
  },
  "hash": "3485f5dddf207c45528ffd3c32ed4f708ae908a6188b58d678b6d89cc067fa81"
}
