This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| class Paginate | |
| def call( | |
| scope, | |
| direction: 'asc', | |
| field: nil, | |
| last_id: nil, | |
| field_value: nil, | |
| limit: nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * FROM | |
| ( | |
| SELECT (CASE WHEN post_id IS NOT NULL THEN ROW_NUMBER() OVER (PARTITION BY (post_id IS NOT NULL)::integer) END) AS r_post, | |
| (CASE WHEN event_id IS NOT NULL THEN ROW_NUMBER() OVER (PARTITION BY (event_id IS NOT NULL)::integer) END) AS r_event, | |
| t.* | |
| FROM feed_items t) | |
| feed_items | |
| WHERE r_post <= VALUE OR r_event <= VALUE; |
OlderNewer