mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
This commit is contained in:
277
.sqlx/query-fb0d1b13928611d566514fd103df973ad1c81fd60efada560e89a2b40a6d3fc1.json
generated
Normal file
277
.sqlx/query-fb0d1b13928611d566514fd103df973ad1c81fd60efada560e89a2b40a6d3fc1.json
generated
Normal file
@@ -0,0 +1,277 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT\n b.id,\n b.title,\n b.lang,\n b.file_type,\n b.year,\n CASE WHEN b.file_type = 'fb2' THEN ARRAY['fb2', 'epub', 'mobi', 'fb2zip']::text[] ELSE ARRAY[b.file_type]::text[] END AS \"available_types!: Vec<String>\",\n b.uploaded,\n COALESCE(\n (\n SELECT\n ARRAY_AGG(\n ROW(\n authors.id,\n authors.first_name,\n authors.last_name,\n authors.middle_name,\n EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )::author_type\n )\n FROM book_authors\n JOIN authors ON authors.id = book_authors.author\n WHERE book_authors.book = b.id\n ),\n ARRAY[]::author_type[]\n ) AS \"authors!: Vec<Author>\",\n COALESCE(\n (\n SELECT\n ARRAY_AGG(\n ROW(\n authors.id,\n authors.first_name,\n authors.last_name,\n authors.middle_name,\n EXISTS(\n SELECT * FROM author_annotations WHERE author = authors.id\n )\n )::author_type\n )\n FROM translations\n JOIN authors ON authors.id = translations.author\n WHERE translations.book = b.id\n ),\n ARRAY[]::author_type[]\n ) AS \"translators!: Vec<Author>\",\n COALESCE(\n (\n SELECT\n ARRAY_AGG(\n ROW(\n sequences.id,\n sequences.name\n )::sequence_type\n )\n FROM book_sequences\n JOIN sequences ON sequences.id = book_sequences.sequence\n WHERE book_sequences.book = b.id\n ),\n ARRAY[]::sequence_type[]\n ) AS \"sequences!: Vec<Sequence>\",\n COALESCE(\n (\n SELECT\n ARRAY_AGG(\n ROW(\n genres.id,\n ROW(\n sources.id,\n sources.name\n )::source_type,\n remote_id,\n genres.code,\n genres.description,\n genres.meta\n )::genre_type\n )\n FROM book_genres\n JOIN genres ON genres.id = book_genres.genre\n JOIN sources ON sources.id = genres.source\n WHERE book_genres.book = b.id\n ),\n ARRAY[]::genre_type[]\n ) AS \"genres!: Vec<Genre>\",\n EXISTS(\n SELECT * FROM book_annotations WHERE book = b.id\n ) AS \"annotation_exists!: bool\",\n (\n SELECT\n ROW(\n sources.id,\n sources.name\n )::source_type\n FROM sources\n WHERE sources.id = b.source\n ) AS \"source!: Source\",\n b.remote_id,\n b.is_deleted,\n b.pages\n FROM books b\n WHERE b.source = $1 AND b.remote_id = $2\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "title",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "lang",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "file_type",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "year",
|
||||
"type_info": "Int2"
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "available_types!: Vec<String>",
|
||||
"type_info": "TextArray"
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "uploaded",
|
||||
"type_info": "Date"
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "authors!: Vec<Author>",
|
||||
"type_info": {
|
||||
"Custom": {
|
||||
"name": "author_type[]",
|
||||
"kind": {
|
||||
"Array": {
|
||||
"Custom": {
|
||||
"name": "author_type",
|
||||
"kind": {
|
||||
"Composite": [
|
||||
[
|
||||
"id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"first_name",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"last_name",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"middle_name",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"annotation_exists",
|
||||
"Bool"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "translators!: Vec<Author>",
|
||||
"type_info": {
|
||||
"Custom": {
|
||||
"name": "author_type[]",
|
||||
"kind": {
|
||||
"Array": {
|
||||
"Custom": {
|
||||
"name": "author_type",
|
||||
"kind": {
|
||||
"Composite": [
|
||||
[
|
||||
"id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"first_name",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"last_name",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"middle_name",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"annotation_exists",
|
||||
"Bool"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "sequences!: Vec<Sequence>",
|
||||
"type_info": {
|
||||
"Custom": {
|
||||
"name": "sequence_type[]",
|
||||
"kind": {
|
||||
"Array": {
|
||||
"Custom": {
|
||||
"name": "sequence_type",
|
||||
"kind": {
|
||||
"Composite": [
|
||||
[
|
||||
"id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"name",
|
||||
"Varchar"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "genres!: Vec<Genre>",
|
||||
"type_info": {
|
||||
"Custom": {
|
||||
"name": "genre_type[]",
|
||||
"kind": {
|
||||
"Array": {
|
||||
"Custom": {
|
||||
"name": "genre_type",
|
||||
"kind": {
|
||||
"Composite": [
|
||||
[
|
||||
"id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"source",
|
||||
{
|
||||
"Custom": {
|
||||
"name": "source_type",
|
||||
"kind": {
|
||||
"Composite": [
|
||||
[
|
||||
"id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"name",
|
||||
"Varchar"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"remote_id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"code",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"description",
|
||||
"Varchar"
|
||||
],
|
||||
[
|
||||
"meta",
|
||||
"Varchar"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "annotation_exists!: bool",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "source!: Source",
|
||||
"type_info": {
|
||||
"Custom": {
|
||||
"name": "source_type",
|
||||
"kind": {
|
||||
"Composite": [
|
||||
[
|
||||
"id",
|
||||
"Int4"
|
||||
],
|
||||
[
|
||||
"name",
|
||||
"Varchar"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "remote_id",
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "is_deleted",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "pages",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int2",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "fb0d1b13928611d566514fd103df973ad1c81fd60efada560e89a2b40a6d3fc1"
|
||||
}
|
||||
Reference in New Issue
Block a user