feat: Add pagination support to ListMediaParams and ListMediaOptions
This commit is contained in:
@@ -99,12 +99,15 @@ impl QueryBuilder<ListMediaOptions> for MediaQueryBuilder {
|
||||
}
|
||||
|
||||
// --- 3. Apply Pagination (Future-Proofing Stub) ---
|
||||
// if let Some(pagination) = &options.pagination {
|
||||
// query.push(" LIMIT ");
|
||||
// query.push_bind(pagination.limit);
|
||||
// query.push(" OFFSET ");
|
||||
// query.push_bind(pagination.offset);
|
||||
// }
|
||||
if let Some(pagination) = &options.pagination {
|
||||
let limit = pagination.limit as i64;
|
||||
let offset = (pagination.page.saturating_sub(1) as i64) * limit;
|
||||
|
||||
query.push(" LIMIT ");
|
||||
query.push_bind(limit);
|
||||
query.push(" OFFSET ");
|
||||
query.push_bind(offset);
|
||||
}
|
||||
|
||||
Ok(query)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user