mirror of
https://github.com/Syfaro/fuzzysearch.git
synced 2024-11-05 22:43:03 +00:00
908cda8ce9
* Use NOTIFY/LISTEN instead of polling for updates. * Allow different distances for multiple hashes.
194 lines
6.9 KiB
JSON
194 lines
6.9 KiB
JSON
{
|
|
"db": "PostgreSQL",
|
|
"1984ce60f052d6a29638f8e05b35671b8edfbf273783d4b843ebd35cbb8a391f": {
|
|
"query": "INSERT INTO\n rate_limit (api_key_id, time_window, group_name, count)\n VALUES\n ($1, $2, $3, $4)\n ON CONFLICT ON CONSTRAINT unique_window\n DO UPDATE set count = rate_limit.count + $4\n RETURNING rate_limit.count",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"ordinal": 0,
|
|
"name": "count",
|
|
"type_info": "Int2"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Left": [
|
|
"Int4",
|
|
"Int8",
|
|
"Text",
|
|
"Int2"
|
|
]
|
|
},
|
|
"nullable": [
|
|
false
|
|
]
|
|
}
|
|
},
|
|
"659ee9ddc1c5ccd42ba9dc1617440544c30ece449ba3ba7f9d39f447b8af3cfe": {
|
|
"query": "SELECT\n api_key.id,\n api_key.name_limit,\n api_key.image_limit,\n api_key.hash_limit,\n api_key.name,\n account.email owner_email\n FROM\n api_key\n JOIN account\n ON account.id = api_key.user_id\n WHERE\n api_key.key = $1\n ",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"ordinal": 0,
|
|
"name": "id",
|
|
"type_info": "Int4"
|
|
},
|
|
{
|
|
"ordinal": 1,
|
|
"name": "name_limit",
|
|
"type_info": "Int2"
|
|
},
|
|
{
|
|
"ordinal": 2,
|
|
"name": "image_limit",
|
|
"type_info": "Int2"
|
|
},
|
|
{
|
|
"ordinal": 3,
|
|
"name": "hash_limit",
|
|
"type_info": "Int2"
|
|
},
|
|
{
|
|
"ordinal": 4,
|
|
"name": "name",
|
|
"type_info": "Varchar"
|
|
},
|
|
{
|
|
"ordinal": 5,
|
|
"name": "owner_email",
|
|
"type_info": "Varchar"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Left": [
|
|
"Text"
|
|
]
|
|
},
|
|
"nullable": [
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
true,
|
|
false
|
|
]
|
|
}
|
|
},
|
|
"6b8d304fc40fa539ae671e6e24e7978ad271cb7a1cafb20fc4b4096a958d790f": {
|
|
"query": "SELECT exists(SELECT 1 FROM twitter_user WHERE lower(data->>'screen_name') = lower($1))",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"ordinal": 0,
|
|
"name": "exists",
|
|
"type_info": "Bool"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Left": [
|
|
"Text"
|
|
]
|
|
},
|
|
"nullable": [
|
|
null
|
|
]
|
|
}
|
|
},
|
|
"f4608ccaf739d36649cdbc5297177a989cc7763006d28c97e219bb708930972a": {
|
|
"query": "SELECT\n hashes.id,\n hashes.hash,\n hashes.furaffinity_id,\n hashes.e621_id,\n hashes.twitter_id,\n CASE\n WHEN furaffinity_id IS NOT NULL THEN (f.url)\n WHEN e621_id IS NOT NULL THEN (e.data->'file'->>'url')\n WHEN twitter_id IS NOT NULL THEN (tm.url)\n END url,\n CASE\n WHEN furaffinity_id IS NOT NULL THEN (f.filename)\n WHEN e621_id IS NOT NULL THEN ((e.data->'file'->>'md5') || '.' || (e.data->'file'->>'ext'))\n WHEN twitter_id IS NOT NULL THEN (SELECT split_part(split_part(tm.url, '/', 5), ':', 1))\n END filename,\n CASE\n WHEN furaffinity_id IS NOT NULL THEN (ARRAY(SELECT f.name))\n WHEN e621_id IS NOT NULL THEN ARRAY(SELECT jsonb_array_elements_text(e.data->'tags'->'artist'))\n WHEN twitter_id IS NOT NULL THEN ARRAY(SELECT tw.data->'user'->>'screen_name')\n END artists,\n CASE\n WHEN furaffinity_id IS NOT NULL THEN (f.file_id)\n END file_id,\n CASE\n WHEN e621_id IS NOT NULL THEN ARRAY(SELECT jsonb_array_elements_text(e.data->'sources'))\n END sources\n FROM\n hashes\n LEFT JOIN LATERAL (\n SELECT *\n FROM submission\n JOIN artist ON submission.artist_id = artist.id\n WHERE submission.id = hashes.furaffinity_id\n ) f ON hashes.furaffinity_id IS NOT NULL\n LEFT JOIN LATERAL (\n SELECT *\n FROM e621\n WHERE e621.id = hashes.e621_id\n ) e ON hashes.e621_id IS NOT NULL\n LEFT JOIN LATERAL (\n SELECT *\n FROM tweet\n WHERE tweet.id = hashes.twitter_id\n ) tw ON hashes.twitter_id IS NOT NULL\n LEFT JOIN LATERAL (\n SELECT *\n FROM tweet_media\n WHERE\n tweet_media.tweet_id = hashes.twitter_id AND\n tweet_media.hash <@ (hashes.hash, 0)\n LIMIT 1\n ) tm ON hashes.twitter_id IS NOT NULL\n WHERE hashes.id = $1",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"ordinal": 0,
|
|
"name": "id",
|
|
"type_info": "Int4"
|
|
},
|
|
{
|
|
"ordinal": 1,
|
|
"name": "hash",
|
|
"type_info": "Int8"
|
|
},
|
|
{
|
|
"ordinal": 2,
|
|
"name": "furaffinity_id",
|
|
"type_info": "Int4"
|
|
},
|
|
{
|
|
"ordinal": 3,
|
|
"name": "e621_id",
|
|
"type_info": "Int4"
|
|
},
|
|
{
|
|
"ordinal": 4,
|
|
"name": "twitter_id",
|
|
"type_info": "Int8"
|
|
},
|
|
{
|
|
"ordinal": 5,
|
|
"name": "url",
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"ordinal": 6,
|
|
"name": "filename",
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"ordinal": 7,
|
|
"name": "artists",
|
|
"type_info": "TextArray"
|
|
},
|
|
{
|
|
"ordinal": 8,
|
|
"name": "file_id",
|
|
"type_info": "Int4"
|
|
},
|
|
{
|
|
"ordinal": 9,
|
|
"name": "sources",
|
|
"type_info": "TextArray"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Left": [
|
|
"Int4"
|
|
]
|
|
},
|
|
"nullable": [
|
|
false,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
null
|
|
]
|
|
}
|
|
},
|
|
"fe60be66b2d8a8f02b3bfe06d1f0e57e4bb07e80cba1b379a5f17f6cbd8b075c": {
|
|
"query": "SELECT id, hash FROM hashes",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"ordinal": 0,
|
|
"name": "id",
|
|
"type_info": "Int4"
|
|
},
|
|
{
|
|
"ordinal": 1,
|
|
"name": "hash",
|
|
"type_info": "Int8"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Left": []
|
|
},
|
|
"nullable": [
|
|
false,
|
|
false
|
|
]
|
|
}
|
|
}
|
|
} |