| 1 |
{ |
| 2 |
"db_name": "PostgreSQL", |
| 3 |
"query": "\n SELECT\n u.username,\n u.email,\n COUNT(*) AS \"total_purchases!\",\n COALESCE(SUM(t.amount_cents), 0)::BIGINT AS \"total_spent_cents!\",\n MAX(t.completed_at) AS \"last_purchase_at!: chrono::DateTime<chrono::Utc>\"\n FROM transactions t\n JOIN users u ON u.id = t.buyer_id\n WHERE t.seller_id = $1\n AND t.status = 'completed'\n AND t.share_contact = true\n AND NOT EXISTS (\n SELECT 1 FROM contact_revocations cr\n WHERE cr.buyer_id = t.buyer_id AND cr.seller_id = t.seller_id\n )\n GROUP BY t.buyer_id, u.username, u.email\n ORDER BY MAX(t.completed_at) DESC\n LIMIT 500\n ", |
| 4 |
"describe": { |
| 5 |
"columns": [ |
| 6 |
{ |
| 7 |
"ordinal": 0, |
| 8 |
"name": "username", |
| 9 |
"type_info": "Varchar" |
| 10 |
}, |
| 11 |
{ |
| 12 |
"ordinal": 1, |
| 13 |
"name": "email", |
| 14 |
"type_info": "Varchar" |
| 15 |
}, |
| 16 |
{ |
| 17 |
"ordinal": 2, |
| 18 |
"name": "total_purchases!", |
| 19 |
"type_info": "Int8" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"ordinal": 3, |
| 23 |
"name": "total_spent_cents!", |
| 24 |
"type_info": "Int8" |
| 25 |
}, |
| 26 |
{ |
| 27 |
"ordinal": 4, |
| 28 |
"name": "last_purchase_at!: chrono::DateTime<chrono::Utc>", |
| 29 |
"type_info": "Timestamptz" |
| 30 |
} |
| 31 |
], |
| 32 |
"parameters": { |
| 33 |
"Left": [ |
| 34 |
"Uuid" |
| 35 |
] |
| 36 |
}, |
| 37 |
"nullable": [ |
| 38 |
false, |
| 39 |
false, |
| 40 |
null, |
| 41 |
null, |
| 42 |
null |
| 43 |
] |
| 44 |
}, |
| 45 |
"hash": "55851c64500231595c4eada326f676033a7e50fd741328e70caaca60b2c2c7a3" |
| 46 |
} |
| 47 |
|