GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
811 B

  1. -- name: SelectStory :one
  2. SELECT * FROM story WHERE id = $1 LIMIT 1;
  3. -- name: SelectStories :many
  4. SELECT * FROM story
  5. WHERE (sqlc.arg(filter_id)::bool = false OR id = ANY(sqlc.arg(ids)::text[]))
  6. AND (sqlc.arg(filter_author)::bool = false OR name = sqlc.arg(author)::text)
  7. AND (sqlc.arg(filter_earlist_fictional_date)::bool = false OR fictional_date >= sqlc.arg(earliest_fictional_date)::timestamp)
  8. AND (sqlc.arg(filter_lastest_fictional_date)::bool = false OR fictional_date <= sqlc.arg(latest_fictional_date)::timestamp)
  9. AND (sqlc.arg(filter_category)::bool = false OR category = sqlc.arg(category)::text)
  10. AND (sqlc.arg(filter_open)::bool = false OR open = sqlc.arg(open)::bool)
  11. AND (sqlc.arg(filter_unlisted)::bool = false OR unlisted = sqlc.arg(unlisted)::bool)
  12. LIMIT sqlc.arg(limit_size)::int;