Files
AstralRinth/apps/labrinth/.sqlx/query-21c44c435bf9a6c138d40cd40d70ccecfd09d877e84f3fbe5cd190dd69d3b7e1.json
2024-10-16 14:11:42 -07:00

53 lines
1.5 KiB
JSON

{
"db_name": "PostgreSQL",
"query": "\n SELECT t.id, t.thread_type, t.mod_id, t.report_id,\n ARRAY_AGG(DISTINCT tm.user_id) filter (where tm.user_id is not null) members,\n JSONB_AGG(DISTINCT jsonb_build_object('id', tmsg.id, 'author_id', tmsg.author_id, 'thread_id', tmsg.thread_id, 'body', tmsg.body, 'created', tmsg.created, 'hide_identity', tmsg.hide_identity)) filter (where tmsg.id is not null) messages\n FROM threads t\n LEFT OUTER JOIN threads_messages tmsg ON tmsg.thread_id = t.id\n LEFT OUTER JOIN threads_members tm ON tm.thread_id = t.id\n WHERE t.id = ANY($1)\n GROUP BY t.id\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int8"
},
{
"ordinal": 1,
"name": "thread_type",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "mod_id",
"type_info": "Int8"
},
{
"ordinal": 3,
"name": "report_id",
"type_info": "Int8"
},
{
"ordinal": 4,
"name": "members",
"type_info": "Int8Array"
},
{
"ordinal": 5,
"name": "messages",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Int8Array"
]
},
"nullable": [
false,
false,
true,
true,
null,
null
]
},
"hash": "21c44c435bf9a6c138d40cd40d70ccecfd09d877e84f3fbe5cd190dd69d3b7e1"
}