1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
//! Pagination support for acton-service
//!
//! This module re-exports pagination types from the paginator-rs family of crates
//! when the appropriate feature flags are enabled. It provides a unified interface
//! for pagination across different contexts (collections, web frameworks, databases).
//!
//! ## Features
//!
//! - `pagination` - Core pagination types and traits from `paginator-rs`
//! - `pagination-axum` - Axum web framework integration from `paginator-axum`
//! - `pagination-sqlx` - SQLx database integration from `paginator-sqlx`
//! - `pagination-full` - All pagination features combined
//!
//! ## Quick Start
//!
//! Add the feature to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! acton-service = { version = "0.12", features = ["pagination-axum"] }
//! ```
//!
//! ## Example: Paginated API Endpoint
//!
//! ```rust,ignore
//! use acton_service::prelude::*;
//!
//! #[derive(Serialize)]
//! struct User {
//! id: u64,
//! name: String,
//! }
//!
//! async fn list_users(
//! Query(params): Query<PaginationQueryParams>,
//! ) -> PaginatedJson<Vec<User>> {
//! let users = vec![
//! User { id: 1, name: "Alice".into() },
//! User { id: 2, name: "Bob".into() },
//! ];
//!
//! // Create paginated response with metadata
//! let metadata = PaginatorResponse {
//! data: users.clone(),
//! page: params.page.unwrap_or(1),
//! per_page: params.per_page.unwrap_or(10),
//! total_items: 2,
//! total_pages: 1,
//! has_next: false,
//! has_prev: false,
//! };
//!
//! PaginatedJson::new(users, metadata)
//! }
//! ```
//!
//! ## Core Types
//!
//! The pagination feature provides these core types:
//!
//! - [`Paginator`] - Main pagination handler for in-memory collections
//! - [`PaginationParams`] - Configuration for pagination operations
//! - [`PaginatorResponse`] - Structured response with pagination metadata
//! - [`Cursor`] and [`CursorBuilder`] - Cursor-based pagination support
//! - [`Filter`] and [`FilterBuilder`] - Data filtering capabilities
//! - [`SortBuilder`] and [`SortDirection`] - Sorting configuration
//!
//! ## Axum Integration
//!
//! With the `pagination-axum` feature:
//!
//! - [`PaginatedJson`] - Response wrapper for paginated JSON data
//! - [`PaginationQuery`] - Extractor for pagination parameters
//! - [`PaginationQueryParams`] - Query parameter handling
//! - [`create_link_header`] - Generate HTTP Link headers for pagination
//!
//! ## SQLx Integration
//!
//! With the `pagination-sqlx` feature:
//!
//! - [`PaginatedQuery`] - Paginated database query results
//! - [`PaginateQuery`] - Trait for pagination behavior
//! - [`QueryBuilderExt`] - Extends SQLx query builder with pagination
//! - [`validate_field_name`] - SQL injection prevention for field names
// ============================================================================
// Core pagination types from paginator-rs
// ============================================================================
// Main paginator types
pub use Paginator;
pub use PaginatorBuilder;
pub use PaginatorResponse;
pub use PaginatorResponseMeta;
pub use PaginatorResult;
pub use PaginatorTrait;
// Pagination parameters
pub use IntoPaginationParams;
pub use PaginationParams;
// Cursor-based pagination
pub use Cursor;
pub use CursorBuilder;
pub use CursorDirection;
pub use CursorValue;
// Filtering
pub use Filter;
pub use FilterBuilder;
pub use FilterOperator;
pub use FilterValue;
// Search
pub use SearchBuilder;
pub use SearchParams;
// Sorting
pub use SortBuilder;
pub use SortDirection;
// Error handling
pub use PaginatorError;
// ============================================================================
// Axum integration from paginator-axum
// ============================================================================
pub use create_link_header;
pub use PaginatedJson;
pub use PaginationQuery;
pub use PaginationQueryParams;
// ============================================================================
// SQLx integration from paginator-sqlx
// ============================================================================
pub use validate_field_name;
pub use PaginateQuery;
pub use PaginatedQuery;
pub use QueryBuilderExt;
// ============================================================================
// Tests
// ============================================================================